]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
ublk: use READ_ONCE() to read struct ublksrv_ctrl_cmd
authorCaleb Sander Mateos <csander@purestorage.com>
Fri, 30 Jan 2026 17:14:13 +0000 (10:14 -0700)
committerJens Axboe <axboe@kernel.dk>
Sat, 31 Jan 2026 13:36:11 +0000 (06:36 -0700)
commited9f54cc1e335096733aed03c2a46de3d58922ed
treedf260d66551f6f558df75182248d9896e43517ff
parentda7e4b75e50c087d2031a92f6646eb90f7045a67
ublk: use READ_ONCE() to read struct ublksrv_ctrl_cmd

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: 87213b0d847c ("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>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/ublk_drv.c