Linux block layer
 help / color / mirror / Atom feed
* [PATCH v2 0/2] ublk: fix auto buf reg ordering around uring_cmd
@ 2026-07-30  1:09 Yang Xiuwei
  2026-07-30  1:09 ` [PATCH v2 1/2] ublk: validate auto buf reg before taking uring_cmd Yang Xiuwei
  2026-07-30  1:09 ` [PATCH v2 2/2] ublk: clear auto buf reg before updating io->buf in batch commit Yang Xiuwei
  0 siblings, 2 replies; 7+ messages in thread
From: Yang Xiuwei @ 2026-07-30  1:09 UTC (permalink / raw)
  To: Ming Lei, Jens Axboe; +Cc: linux-block, Caleb Sander Mateos, Yang Xiuwei

Two UBLK_F_AUTO_BUF_REG ordering fixes.

Patch 1: invalid auto_buf in sqe->addr can fail after ublk_fill_io_cmd()
has already set UBLK_IO_FLAG_ACTIVE. Split validate/apply so the check
has no side effects, then take the uring_cmd and store the validated
buffer.

Patch 2: batch commit wrote the new auto_buf into io->buf before
ublk_clear_auto_buf_reg(), so unregister could target the new index and
leave the old registered buffer behind. Clear first, then update
io->buf.

Changes in v2:
- patch 1: validate before __ublk_fetch()/fill; apply is infallible
  (per Caleb's review)
- add patch 2 for the batch commit clear/store order

Tested: 
ublk selftests generic_08/09, batch_01..03, stress_08;
liburing uring_cmd_ublk.t

v1: https://lore.kernel.org/linux-block/20260724100327.43482-1-yangxiuwei@kylinos.cn/

Yang Xiuwei (2):
  ublk: validate auto buf reg before taking uring_cmd
  ublk: clear auto buf reg before updating io->buf in batch commit

 drivers/block/ublk_drv.c | 76 +++++++++++++++++++++-------------------
 1 file changed, 39 insertions(+), 37 deletions(-)

-- 
2.25.1


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

end of thread, other threads:[~2026-07-31 16:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-30  1:09 [PATCH v2 0/2] ublk: fix auto buf reg ordering around uring_cmd Yang Xiuwei
2026-07-30  1:09 ` [PATCH v2 1/2] ublk: validate auto buf reg before taking uring_cmd Yang Xiuwei
2026-07-31 16:10   ` Ming Lei
2026-07-30  1:09 ` [PATCH v2 2/2] ublk: clear auto buf reg before updating io->buf in batch commit Yang Xiuwei
2026-07-30  2:40   ` [PATCH] selftests: ublk: add rotating auto_buf index regression test Yang Xiuwei
2026-07-31 16:24     ` Ming Lei
2026-07-31 16:13   ` [PATCH v2 2/2] ublk: clear auto buf reg before updating io->buf in batch commit Ming Lei

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