public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] ublk: fix struct ublksrv_ctrl_cmd accesses
@ 2026-01-30 17:14 Caleb Sander Mateos
  2026-01-30 17:14 ` [PATCH v2 1/3] ublk: Validate SQE128 flag before accessing the cmd Caleb Sander Mateos
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Caleb Sander Mateos @ 2026-01-30 17:14 UTC (permalink / raw)
  To: Ming Lei, Jens Axboe
  Cc: Govindarajulu Varadarajan, linux-block, linux-kernel,
	Caleb Sander Mateos

struct ublksrv_ctrl_cmd is part of the io_uring_sqe. Since commit
87213b0d847c ("ublk: allow non-blocking ctrl cmds in IO_URING_F_NONBLOCK
issue") allowed some commands to be handled in the non-blocking issue,
the SQE may lie in userspace-mapped memory. Validate that the SQE size
is the expected 128 bytes before dereferencing it. Use READ_ONCE() to
copy the ublksrv_ctrl_cmd from the SQE to a local variable. This avoids
data races if userspace writes to the SQE concurrently.

v2:
- Make a local copy of the struct ublksrv_ctrl_cmd (Ming)
- Add Reviewed-by tag (Ming)

Caleb Sander Mateos (2):
  ublk: use READ_ONCE() to read struct ublksrv_ctrl_cmd
  ublk: drop ublk_ctrl_start_recovery() header argument

Govindarajulu Varadarajan (1):
  ublk: Validate SQE128 flag before accessing the cmd

 drivers/block/ublk_drv.c | 65 +++++++++++++++++++++-------------------
 1 file changed, 35 insertions(+), 30 deletions(-)

-- 
2.45.2


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-02-02 15:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-30 17:14 [PATCH v2 0/3] ublk: fix struct ublksrv_ctrl_cmd accesses Caleb Sander Mateos
2026-01-30 17:14 ` [PATCH v2 1/3] ublk: Validate SQE128 flag before accessing the cmd Caleb Sander Mateos
2026-01-30 17:14 ` [PATCH v2 2/3] ublk: use READ_ONCE() to read struct ublksrv_ctrl_cmd Caleb Sander Mateos
2026-01-31  2:08   ` Ming Lei
2026-02-02 15:38     ` Caleb Sander Mateos
2026-01-30 17:14 ` [PATCH v2 3/3] ublk: drop ublk_ctrl_start_recovery() header argument Caleb Sander Mateos
2026-01-31  2:09   ` Ming Lei
2026-01-31 13:49 ` [PATCH v2 0/3] ublk: fix struct ublksrv_ctrl_cmd accesses Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox