diff options
author | Klaus Jensen <k.jensen@samsung.com> | 2023-08-08 17:16:13 +0200 |
---|---|---|
committer | Michael Tokarev <mjt@tls.msk.ru> | 2023-09-10 19:39:41 +0300 |
commit | 43328764f7a0c4371f0142a8cee6dcdbeecfa633 (patch) | |
tree | 16af3e0041a4fb79e06fe06d8b86ca53a14525c7 | |
parent | f47369c3d114ddd2021d9ca2cdde9fe138675bcb (diff) | |
download | qemu-43328764f7a0c4371f0142a8cee6dcdbeecfa633.zip qemu-43328764f7a0c4371f0142a8cee6dcdbeecfa633.tar.gz qemu-43328764f7a0c4371f0142a8cee6dcdbeecfa633.tar.bz2 |
hw/nvme: fix null pointer access in directive receive
nvme_directive_receive() does not check if an endurance group has been
configured (set) prior to testing if flexible data placement is enabled
or not.
Fix this.
Cc: qemu-stable@nongnu.org
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1815
Fixes: 73064edfb864 ("hw/nvme: flexible data placement emulation")
Reviewed-by: Jesper Wendel Devantier <j.devantier@samsung.com>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
(cherry picked from commit 6c8f8456cb0b239812dee5211881426496da7b98)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-rw-r--r-- | hw/nvme/ctrl.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index 00b910c..ac50572 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -6877,7 +6877,7 @@ static uint16_t nvme_directive_receive(NvmeCtrl *n, NvmeRequest *req) case NVME_DIRECTIVE_IDENTIFY: switch (doper) { case NVME_DIRECTIVE_RETURN_PARAMS: - if (ns->endgrp->fdp.enabled) { + if (ns->endgrp && ns->endgrp->fdp.enabled) { id.supported |= 1 << NVME_DIRECTIVE_DATA_PLACEMENT; id.enabled |= 1 << NVME_DIRECTIVE_DATA_PLACEMENT; id.persistent |= 1 << NVME_DIRECTIVE_DATA_PLACEMENT; |