Skip to content

virtio: Add length checks for device writable portions

Max Gurtovoy kvm linux-block virtualization 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2virtio_blk: add length check for device writable portiondrivers/block/virtio_blk.c+20 -01 reply
2/2virtio_fs: add length check for device writable portionfs/fuse/virtio_fs.c+9 -00 replies

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchAurelien Aptel
1/2R-b
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH v1 0/2] virtio: Add length checks for device writable portions

Hi,

This patch series introduces safety checks in virtio-blk and virtio-fs drivers to ensure proper handling of device-writable buffer lengths as specified by the virtio specification.

The virtio specification states:
"The driver MUST NOT make assumptions about data in device-writable buffers beyond the first len bytes, and SHOULD ignore this data."

To align with this requirement, we introduce checks in both drivers to verify that the length of data written by the device is at least as large as the expected/needed payload.

If this condition is not met, we set an I/O error status to prevent processing of potentially invalid or incomplete data.

These changes improve the robustness of the drivers and ensure better compliance with the virtio specification.

Max Gurtovoy (2):
virtio_blk: add length check for device writable portion
virtio_fs: add length check for device writable portion

 drivers/block/virtio_blk.c | 20 ++++++++++++++++++++
 fs/fuse/virtio_fs.c        |  9 +++++++++
 2 files changed, 29 insertions(+)
Signature · 1 line
2.18.1