From: Klaus Jensen <its@irrelevant.dk>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
Klaus Jensen <k.jensen@samsung.com>,
qemu-stable@nongnu.org,
Jesper Wendel Devantier <foss@defmacro.it>,
Keith Busch <kbusch@kernel.org>, Klaus Jensen <its@irrelevant.dk>,
qemu-block@nongnu.org
Subject: [PULL 4/5] hw/nvme: bound zrwa flush by the write area and zone write boundary
Date: Fri, 20 Nov 2026 13:29:48 +0100 [thread overview]
Message-ID: <20261120122949.1044-5-its@irrelevant.dk> (raw)
In-Reply-To: <20261120122949.1044-1-its@irrelevant.dk>
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")
Reviewed-by: Jesper Wendel Devantier <foss@defmacro.it>
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
next prev parent reply other threads:[~2026-11-20 12:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 12:29 [PULL 0/5] hw/nvme fixes Klaus Jensen
2026-11-20 12:29 ` [PULL 1/5] hw/nvme: report data transfer error on failed dma Klaus Jensen
2026-11-20 12:29 ` [PULL 2/5] hw/nvme: fix zone descriptor extension allocation overflow Klaus Jensen
2026-11-20 12:29 ` [PULL 3/5] hw/nvme: fix open zone zrwa allocation Klaus Jensen
2026-11-20 12:29 ` Klaus Jensen [this message]
2026-11-20 12:29 ` [PULL 5/5] hw/nvme: advance zone write pointer only once the write is committed Klaus Jensen
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=20261120122949.1044-5-its@irrelevant.dk \
--to=its@irrelevant.dk \
--cc=foss@defmacro.it \
--cc=k.jensen@samsung.com \
--cc=kbusch@kernel.org \
--cc=peter.maydell@linaro.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.