[PATCH v2 0/2] ublk: fix auto buf reg ordering around uring_cmd
Yang Xiuwei <[email protected]> Thu, 30 Jul 2026 09:09:08 +0800
| Newsgroups | org.kernel.vger.linux-block |
|---|---|
| Message-ID | <[email protected]> |
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/[email protected]/ 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