Linux block layer
 help / color / mirror / Atom feed
From: Damien Le Moal <dlemoal@kernel.org>
To: Annie Kim <pulpannie@gmail.com>,
	"Michael S . Tsirkin" <mst@redhat.com>,
	Jason Wang <jasowangio@gmail.com>
Cc: Jens Axboe <axboe@kernel.dk>,
	virtualization@lists.linux.dev, linux-block@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] virtio_blk: validate zone append sector from device
Date: Tue, 24 Nov 2026 13:24:04 +0900	[thread overview]
Message-ID: <dc7e8985-733c-4e64-88fe-88323735263b@kernel.org> (raw)
In-Reply-To: <20261123084701.2616027-1-pulpannie@gmail.com>

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

Looks OK to me.

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>

-- 
Damien Le Moal
Western Digital Research

      reply	other threads:[~2026-11-24  4:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23  8:46 [PATCH v2] virtio_blk: validate zone append sector from device Annie Kim
2026-11-24  4:24 ` Damien Le Moal [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dc7e8985-733c-4e64-88fe-88323735263b@kernel.org \
    --to=dlemoal@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=jasowangio@gmail.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=pulpannie@gmail.com \
    --cc=virtualization@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox