> From: Hyokyung Kim <[email protected]> > > The device reports the starting sector for REQ_OP_ZONE_APPEND completions, > and virtio_blk copies it into req->__sector without checking that it > still refers to the requested zone. A buggy or malicious device can > therefore make upper layers believe the append landed at an arbitrary > location. > > Validate successful zone append completions before updating > req->__sector. The returned sector must not precede the request start > and the entire request must fit within the zone writable capacity. > Reject invalid completions with BLK_STS_IOERR. > > The polling path may batch successful completions, and a batch can only > be completed as successful. Perform the same validation in > virtblk_poll() before admitting a request to the batch, so that invalid > zone append completions are not batched and are completed with an error > instead. Move the request completion into __virtblk_request_done(), > which takes the status from its caller, so that a polled completion that > is not batched is not validated a second time. > > Fixes: 95bfec41bd3d ("virtio-blk: add support for zoned block devices") > Signed-off-by: Hyokyung Kim <[email protected]>
Sashiko has reviewed this patch and found no issues. -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=1
