[Devel] [PATCH hci-8.1 v2 3/3] drivers/vhost/blk: take req->len from one side of the descriptor chain

no-reply at sashiko.virtuozzo.com no-reply at sashiko.virtuozzo.com
Thu Oct 29 16:02:56 MSK 2026


> req->len covered the whole descriptor chain, so both readable and
> writable data buffers became the payload. A read wrote disk data into
> device-readable buffers and reported them as used, a write sent the
> guest's writable buffers to disk.
> 
> Take write data only from the readable part and the payload of other
> requests only from the writable part, as QEMU does. Read the status
> byte from the end of the writable part.
> 
> Complete a read or write with VIRTIO_BLK_S_IOERR if its payload is
> empty, above ALIGN_DOWN(INT_MAX, SECTOR_SIZE) or, for a write, not a
> multiple of SECTOR_SIZE. An empty payload used to fail in bio setup
> and an unaligned write hit a WARN_ONCE() reachable from the guest.
> In both cases the kick handler broke out with the descriptor consumed
> and notifications disabled, so the virtqueue stalled. Drop the
> WARN_ONCE().
> 
> The size bound is new for writes: the readable side had no limit and
> a write of any size was submitted. Reads above INT_MAX still get
> -EINVAL from the in_len check, the bound only covers the range below
> it.
> 
> https://virtuozzo.atlassian.net/browse/VSTOR-142755
> Fixes: 1629db092dd7 ("drivers/vhost: vhost-blk accelerator for virtio-blk guests")
> Fixes: 02ce37f62707 ("vhost-blk: add bounce-buffer for non-aligned requests")
> Feature: vhost-blk: in-kernel accelerator for virtio-blk guests
> Signed-off-by: Alexander Ivanov <alexander.ivanov at virtuozzo.com>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261029125923.3352735-1-alexander.ivanov@virtuozzo.com?part=3




More information about the Devel mailing list