|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 3/4] [WTF] avoid qemu_del_nic() in xen_netdev_unrealize() on shutdown
From: David Woodhouse <dwmw@xxxxxxxxxxxx>
When QEMU is exiting, qemu_cleanup() calls net_cleanup(), which deletes
the NIC from underneath the xen-net-device. When xen_netdev_unrealize()
is later called via the xenbus exit notifier, it crashes.
Signed-off-by: David Woodhouse <dwmw@xxxxxxxxxxxx>
---
hw/net/xen_nic.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/hw/net/xen_nic.c b/hw/net/xen_nic.c
index 84914c329c..8d25fb3101 100644
--- a/hw/net/xen_nic.c
+++ b/hw/net/xen_nic.c
@@ -25,6 +25,8 @@
#include "qapi/qmp/qdict.h"
#include "qapi/error.h"
+#include "sysemu/runstate.h"
+
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <sys/wait.h>
@@ -530,7 +532,11 @@ static void xen_netdev_unrealize(XenDevice *xendev)
/* Disconnect from the frontend in case this has not already happened */
xen_netdev_disconnect(xendev, NULL);
- if (netdev->nic) {
+ /*
+ * WTF? In RUN_STATE_SHUTDOWN, qemu_cleanup()→net_cleanup() already deleted
+ * our NIC from underneath us!
+ */
+ if (netdev->nic && !runstate_check(RUN_STATE_SHUTDOWN)) {
qemu_del_nic(netdev->nic);
}
}
--
2.40.1
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |