[PATCH] qemu_driver: fix potential null pointer dereference in qemuConnectCPUModelBaseline()
qemuMonitorGetCPUModelExpansion() may return 0 without assigning a value to model_info if QEMU returns a GenericError. Passing NULL to qemuConnectStealCPUModelFromInfo() can lead to the NULL pointer dereference. Check the result before stealing the CPU model to avoid this. Fixes: aa797c6625 (qemu_driver: expand cpu features after baseline) Signed-off-by: Elizaveta Tereshkina <teryoshkina.ea@gmail.com> --- src/qemu/qemu_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index ebf19d7c0f..5922065897 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -12382,7 +12382,7 @@ qemuConnectCPUModelBaseline(virQEMUCaps *qemuCaps, false, false, &result) < 0) return NULL; - if (qemuConnectStealCPUModelFromInfo(baseline, &result) < 0) + if (result && qemuConnectStealCPUModelFromInfo(baseline, &result) < 0) return NULL; } -- 2.43.0
participants (1)
-
Elizaveta Tereshkina