[Devel] [PATCH hci-8.1 v2 0/3] drivers/vhost/blk: fix virtio-blk request header and payload parsing

Alexander Ivanov alexander.ivanov at virtuozzo.com
Thu Oct 29 15:59:20 MSK 2026


vhost-blk parsed guest requests from the whole descriptor chain without
telling the device-readable part from the device-writable one, and used
the header fields without byte order conversion.

Patch 1 converts hdr->type and hdr->sector to CPU byte order.

Patch 2 takes the request header only from the readable part and drops
requests whose readable part is shorter than the header.

Patch 3 takes the write payload from the readable part and the payload
of other requests from the writable part, reads the status byte from
the end of the writable part, and completes reads and writes with an
empty, oversized or misaligned payload with VIRTIO_BLK_S_IOERR.

v2:
- patch 2, 3: fix the description of the old behaviour in the commit
  messages, no code changes.

https://virtuozzo.atlassian.net/browse/VSTOR-142755

Alexander Ivanov (3):
  drivers/vhost/blk: convert virtio_blk_outhdr fields to CPU byte order
  drivers/vhost/blk: take virtio_blk_outhdr only from the readable part
  drivers/vhost/blk: take req->len from one side of the descriptor chain

 drivers/vhost/blk.c | 56 ++++++++++++++++++++++++++++++++-------------
 1 file changed, 40 insertions(+), 16 deletions(-)

-- 
2.53.0



More information about the Devel mailing list