All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jesper Wendel Devantier <foss@defmacro.it>
To: Klaus Jensen <its@irrelevant.dk>
Cc: qemu-devel@nongnu.org, Keith Busch <kbusch@kernel.org>,
	qemu-block@nongnu.org, Klaus Jensen <k.jensen@samsung.com>,
	qemu-stable@nongnu.org
Subject: Re: [PATCH 2/3] hw/nvme: bound zrwa flush by the write area and zone write boundary
Date: Thu, 19 Nov 2026 11:38:43 +0000	[thread overview]
Message-ID: <20261119123843.4-foss@defmacro.it> (raw)
In-Reply-To: <20261118-fix-4520-v1-2-dfa182213376@samsung.com>



On Wed, 18 Nov 2026 13:45:35 +0100, Klaus Jensen <its@irrelevant.dk> wrote:
> From: Klaus Jensen <k.jensen@samsung.com>
>
> nvme_zone_mgmt_send_zrwa_flush incorrectly accepts a flush up to and
> including one LBA past the zone random write area. Fix the comparison.
>
> Additionally, there is no check that the last LBA to be flushed falls
> within the zone boundary (i.e., the *capacity* of the zone). That is, if
> a zone has a small capacity than size, the write pointer can be pushed
> past it. Fix with a check on the zone write boundary.
>
> Cc: qemu-stable@nongnu.org
> Link: https://gitlab.com/qemu-project/qemu/-/work_items/4520
> Fixes: e321b4cdc2dd ("hw/nvme: add support for zoned random write area")
> Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
> ---
>  hw/nvme/ctrl.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
> index 16860ccd9520..35e2c57851ae 100644
> --- a/hw/nvme/ctrl.c
> +++ b/hw/nvme/ctrl.c
> @@ -4279,7 +4279,8 @@ static uint16_t nvme_zone_mgmt_send_zrwa_flush(NvmeCtrl *n, NvmeZone *zone,
>          return NVME_INVALID_FIELD | NVME_DNR;
>      }
>  
> -    if (elba < wp || elba > wp + ns->zns.zrwas) {
> +    if (elba < wp || elba >= wp + ns->zns.zrwas ||
> +        elba >= nvme_zone_wr_boundary(zone)) {
>          return NVME_ZONE_BOUNDARY_ERROR | NVME_DNR;
>      }
>  
>
> -- 
> 2.53.0
>
>
>

Reviewed-by: Jesper Wendel Devantier <foss@defmacro.it>



  reply	other threads:[~2026-11-19 11:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18 12:45 [PATCH 0/3] hw/nvme: zns/zrwa fixes Klaus Jensen
2026-11-18 12:45 ` [PATCH 1/3] hw/nvme: fix open zone zrwa allocation Klaus Jensen
2026-11-19 11:09   ` Jesper Wendel Devantier
2026-11-18 12:45 ` [PATCH 2/3] hw/nvme: bound zrwa flush by the write area and zone write boundary Klaus Jensen
2026-11-19 11:38   ` Jesper Wendel Devantier [this message]
2026-11-18 12:45 ` [PATCH 3/3] hw/nvme: advance zone write pointer only once the write is committed Klaus Jensen
2026-11-19 11:35   ` Jesper Wendel Devantier

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=20261119123843.4-foss@defmacro.it \
    --to=foss@defmacro.it \
    --cc=its@irrelevant.dk \
    --cc=k.jensen@samsung.com \
    --cc=kbusch@kernel.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.