[PATCH] qemu: Check sev capability pointer before using it

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



https://bugzilla.redhat.com/show_bug.cgi?id=1612009

Check sev capability pointer in function qemuGetSEVInfoToParams to avoid
null pointer dereferences.

Signed-off-by: Han Han <hhan@xxxxxxxxxx>
---
 src/qemu/qemu_driver.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index fb0d4a8c7a..3daaef586f 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -21452,6 +21452,12 @@ qemuGetSEVInfoToParams(virQEMUCapsPtr qemuCaps,
 
     virCheckFlags(VIR_TYPED_PARAM_STRING_OKAY, -1);
 
+    if (!sev) {
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+                       _("SEV is not supported in this guest"));
+        return -1;
+    }
+
     if (virTypedParamsAddString(&sevParams, &n, &maxpar,
                     VIR_NODE_SEV_PDH, sev->pdh) < 0)
         return -1;
-- 
2.18.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux