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] hw/nvme: verify source and destination lba size for copy
Date: Fri, 6 Nov 2026 15:55:41 +0100 [thread overview]
Message-ID: <20261106154416.0-foss@defmacro.it> (raw)
In-Reply-To: <20261021-fix-4173-v1-1-e8045545f954@samsung.com>
On 2026-10-21T15:37:46+02:00, Klaus Jensen <its@irrelevant.dk> wrote:
> From: Klaus Jensen <k.jensen@samsung.com>
>
> Cross-namespace copy requires the source and destination namespace to
> have the same logical block size. This is not verified, causing a heap
> out-of-bounds write.
>
> Fix by correctly identifying the invalid operation.
>
> Cc: qemu-stable@nongnu.org
> Reported-by: Feng Xue and XGPT of ThreatBook
> Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4173
> Fixes: d522aef88d42 ("hw/nvme: add cross namespace copy support")
> Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
> ---
> hw/nvme/ctrl.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
> index 578421c21761..b48bf599b5d6 100644
> --- a/hw/nvme/ctrl.c
> +++ b/hw/nvme/ctrl.c
> @@ -3277,6 +3277,11 @@ static void nvme_do_copy(NvmeCopyAIOCB *iocb)
> status = NVME_INVALID_FIELD | NVME_DNR;
> goto invalid;
> } else if (snsid != dnsid) {
> + if (sns->lbaf.ds != dns->lbaf.ds) {
> + status = NVME_CMD_INCOMP_NS_OR_FMT | NVME_DNR;
> + goto invalid;
> + }
> +
> if (!NVME_ID_NS_DPS_TYPE(sns->id_ns.dps) &&
> !NVME_ID_NS_DPS_TYPE(dns->id_ns.dps)) {
> if (!nvme_copy_matching_ns_format(sns, dns, false)) {
>
> ---
> base-commit: 8967b2fe1b2aaae3c29e207d85fab901d580a2dc
> change-id: 20261021-fix-4173-d188c1a2ffdf
>
> Best regards,
> --
> Klaus Jensen <k.jensen@samsung.com>
>
>
>
Reviewed-by: Jesper Wendel Devantier <foss@defmacro.it>
prev parent reply other threads:[~2026-11-06 14:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-21 13:37 [PATCH] hw/nvme: verify source and destination lba size for copy Klaus Jensen
2026-11-06 14:55 ` Jesper Wendel Devantier [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=20261106154416.0-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.