commit 3b6a2b6b7466f6dea53243900b7516c3f29027b7
parent ffa95097ee9937a799c965201381a28e0860339c
Author: Carlos Bilbao <carlos.bilbao@amd.com>
Date: Fri, 28 Oct 2022 09:07:13 -0500
i386/sev: Fix segfault retrieving SEV capabilities
Return from sev_get_capabilities when sev_common is not on. This fixes
a segmentation fault when retrieving SEV capabilities, for example with
libvirt.
Signed-off-by: Alexey Kardashevskiy <Alexey.Kardashevskiy@amd.com>
Signed-off-by: Carlos Bilbao <carlos.bilbao@amd.com>
Diffstat:
1 file changed, 1 insertion(+), 0 deletions(-)
diff --git a/target/i386/sev.c b/target/i386/sev.c
@@ -838,6 +838,7 @@ sev_get_capabilities(Error **errp)
sev_common = SEV_COMMON(MACHINE(qdev_get_machine())->cgs);
if (!sev_common) {
error_setg(errp, "SEV is not configured");
+ return NULL;
}
sev_device = object_property_get_str(OBJECT(sev_common), "sev-device",