computing-offload/generic_vdpa/libvirt/libvirt-qemu-add-pointer-check-in-qemuMonitorLastError.patch
jiangdongxu 79c4324644 add generic_vdpa basecode
Change-Id: I2d302dda68298877c65c99147f5bf22186a59aac
2024-09-19 17:19:46 +08:00

33 lines
1.0 KiB
Diff

From 2d72ad8dfbd8987379a58fd9b280cdaf4d191542 Mon Sep 17 00:00:00 2001
From: Feng Ni <fengni@huawei.com>
Date: Wed, 15 Apr 2020 11:14:35 +0800
Subject: qemu: add pointer check in qemuMonitorLastError
We found a exception when libvirt occurrs segmentation fault.
thread 1 is waiting object lock in qemuConnectMonitor,
qemu process exits and sends EOF event as well, so thread 2 invokes
qemuMonitorLastError but pointer mon is NULL.
Signed-off-by: Feng Ni <fengni@huawei.com>
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
---
src/qemu/qemu_monitor.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index a62fed8..cc62948 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -966,7 +966,7 @@ qemuMonitorSend(qemuMonitorPtr mon,
virErrorPtr
qemuMonitorLastError(qemuMonitorPtr mon)
{
- if (mon->lastError.code == VIR_ERR_OK)
+ if (!mon || mon->lastError.code == VIR_ERR_OK)
return NULL;
return virErrorCopyNew(&mon->lastError);
--
2.23.0