Skip to content

ublk: fix struct ublksrv_ctrl_cmd accesses#539

Open
blktests-ci[bot] wants to merge 3 commits intolinus-master_basefrom
series/1048738=>linus-master
Open

ublk: fix struct ublksrv_ctrl_cmd accesses#539
blktests-ci[bot] wants to merge 3 commits intolinus-master_basefrom
series/1048738=>linus-master

Conversation

@blktests-ci
Copy link

@blktests-ci blktests-ci bot commented Feb 3, 2026

Pull request for series with
subject: ublk: fix struct ublksrv_ctrl_cmd accesses
version: 2
url: https://patchwork.kernel.org/project/linux-block/list/?series=1049091

@blktests-ci
Copy link
Author

blktests-ci bot commented Feb 3, 2026

Upstream branch: de0674d
series: https://patchwork.kernel.org/project/linux-block/list/?series=1049091
version: 2

@blktests-ci
Copy link
Author

blktests-ci bot commented Feb 5, 2026

Upstream branch: f14faaf
series: https://patchwork.kernel.org/project/linux-block/list/?series=1049091
version: 2

@blktests-ci blktests-ci bot force-pushed the series/1048738=>linus-master branch from 524660a to 2d06f83 Compare February 5, 2026 03:29
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch from 7c2ae0a to 54294d6 Compare February 6, 2026 08:51
@blktests-ci
Copy link
Author

blktests-ci bot commented Feb 6, 2026

Upstream branch: b7ff715
series: https://patchwork.kernel.org/project/linux-block/list/?series=1049091
version: 2

@blktests-ci blktests-ci bot force-pushed the series/1048738=>linus-master branch from 2d06f83 to 0b34806 Compare February 6, 2026 08:51
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch from 54294d6 to eb49f7b Compare February 8, 2026 02:55
govind-varadar and others added 2 commits February 8, 2026 13:20
ublk_ctrl_cmd_dump() accesses (header *)sqe->cmd before
IO_URING_F_SQE128 flag check. This could cause out of boundary memory
access.

Move the SQE128 flag check earlier in ublk_ctrl_uring_cmd() to return
-EINVAL immediately if the flag is not set.

Fixes: 71f28f3 ("ublk_drv: add io_uring based userspace block driver")
Signed-off-by: Govindarajulu Varadarajan <govind.varadar@gmail.com>
Reviewed-by: Caleb Sander Mateos <csander@purestorage.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
struct ublksrv_ctrl_cmd is part of the io_uring_sqe, which may lie in
userspace-mapped memory. It's racy to access its fields with normal
loads, as userspace may write to them concurrently. Use READ_ONCE() to
copy the ublksrv_ctrl_cmd from the io_uring_sqe to the stack. Use the
local copy in place of the one in the io_uring_sqe.

Fixes: 87213b0 ("ublk: allow non-blocking ctrl cmds in IO_URING_F_NONBLOCK issue")
Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
@blktests-ci
Copy link
Author

blktests-ci bot commented Feb 8, 2026

Upstream branch: e7aa572
series: https://patchwork.kernel.org/project/linux-block/list/?series=1049091
version: 2

ublk_ctrl_start_recovery() only uses its const struct ublksrv_ctrl_cmd *
header argument to log the dev_id. But this value is already available
in struct ublk_device's ub_number field. So log ub_number instead and
drop the unused header argument.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
@blktests-ci blktests-ci bot force-pushed the series/1048738=>linus-master branch from 0b34806 to 8f2eaa6 Compare February 8, 2026 04:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants