Commit c0080f5603 for qemu.org

commit c0080f56036249df4a3f56e07e90cb0e56b3fd34
Author: Klaus Jensen <k.jensen@samsung.com>
Date:   Fri Nov 13 10:58:40 2026 +0100

    hw/nvme: fix broadcast fdp events handling

    The Set Features handler for the FDP Events feature asserts that a
    namespace is passed in the command because the feature is
    namespace-specific. An invalid namespace is rejected prior to reaching
    the handler, but the "broadcast nsid" (0xFFFFFFFF) is considered valid
    and causes the assert to abort QEMU.

    Reject it with Invalid Field in Command instead as per the
    specification.

    Cc: qemu-stable@nongnu.org
    Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4792
    Fixes: 73064edfb864 ("hw/nvme: flexible data placement emulation")
    Reviewed-by: Jesper Wendel Devantier <foss@defmacro.it>
    Signed-off-by: Klaus Jensen <k.jensen@samsung.com>

diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index a0d22daced..71c24dc02b 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -6636,7 +6636,9 @@ static uint16_t nvme_set_feature_fdp_events(NvmeCtrl *n, NvmeNamespace *ns,
     g_autofree uint8_t *events = NULL;
     NvmeRuHandle *ruh = NULL;

-    assert(ns);
+    if (!ns) {
+        return NVME_INVALID_FIELD | NVME_DNR;
+    }

     if (!n->subsys || !n->subsys->endgrp.fdp.enabled) {
         return NVME_FDP_DISABLED | NVME_DNR;