[PATCH v2 0/3] ublk: harden user buffer handling

Caleb Sander Mateos <[email protected]> Wed, 29 Jul 2026 11:10:38 -0600
Newsgroups org.kernel.vger.linux-block,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
For ublk devices not using user copy or zero copy, the ublk driver
copies request data to/from an arbitrary buffer provided by the
userspace ublk server on each I/O.

Fix several bugs where the kernel driver is overly trusting of the
userspace buffer. Ensure that an invalid userspace buffer at worst
results in a failed or requeued I/O and can't trigger panics or
undefined behavior.

v2:
- Check import_ubuf() return value (Ming)
- Avoid calling blk_update_request() with nr_bytes=0

v1: https://lore.kernel.org/linux-block/[email protected]/

Caleb Sander Mateos (3):
  ublk: check import_ubuf() return value
  ublk: check for ublk_unmap_io() returning 0
  ublk: remove WARN_ON_ONCE() in ublk_unmap_io()

 drivers/block/ublk_drv.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

-- 
2.54.0