Re: [PATCH v2] virtio_blk: validate zone append sector from device

From: Damien Le Moal

Date: Mon Nov 23 2026 - 23:24:15 EST


On 11/23/26 17:46, Annie Kim wrote:
> From: Hyokyung Kim <pulpannie@xxxxxxxxx>
>
> 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 <pulpannie@xxxxxxxxx>

Looks OK to me.

Reviewed-by: Damien Le Moal <dlemoal@xxxxxxxxxx>

--
Damien Le Moal
Western Digital Research