]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
hw/nvme: fix leak of uninitialized memory in io_mgmt_recv
authorKlaus Jensen <k.jensen@samsung.com>
Tue, 20 Aug 2024 04:16:48 +0000 (06:16 +0200)
committerMichael Tokarev <mjt@tls.msk.ru>
Wed, 28 Aug 2024 05:37:15 +0000 (08:37 +0300)
Yutaro Shimizu from the Cyber Defense Institute discovered a bug in the
NVMe emulation that leaks contents of an uninitialized heap buffer if
subsystem and FDP emulation are enabled.

Cc: qemu-stable@nongnu.org
Reported-by: Yutaro Shimizu <shimizu@cyberdefense.jp>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
(cherry picked from commit 6a22121c4f25b181e99479f65958ecde65da1c92)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
hw/nvme/ctrl.c

index 1fa117fdff4f1f502e53237c355c44c970f9c03f..ca54c250b2f7de888c36dcb352b91701a415630e 100644 (file)
@@ -4302,7 +4302,7 @@ static uint16_t nvme_io_mgmt_recv_ruhs(NvmeCtrl *n, NvmeRequest *req,
 
     nruhsd = ns->fdp.nphs * endgrp->fdp.nrg;
     trans_len = sizeof(NvmeRuhStatus) + nruhsd * sizeof(NvmeRuhStatusDescr);
-    buf = g_malloc(trans_len);
+    buf = g_malloc0(trans_len);
 
     trans_len = MIN(trans_len, len);