Skip to content

ublk: harden user buffer handling

Caleb Sander Mateos linux-block lkml 1 version Applied

Status from this message: Applied, thanks!

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest3 patches 1 replyApplied

Changes in v2 from the cover letter

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

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/3ublk: check import_ubuf() return valuedrivers/block/ublk_drv.c+8 -20 replies
2/3ublk: check for ublk_unmap_io() returning 0drivers/block/ublk_drv.c+7 -10 replies
3/3ublk: remove WARN_ON_ONCE() in ublk_unmap_io()drivers/block/ublk_drv.c+0 -20 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

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

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(-)
Signature · 1 line
2.54.0