]> xenbits.xensource.com Git - people/aperard/qemu-dm.git/commitdiff
xen-block: fix segv on unrealize wip.fix-segv
authorAnthony PERARD <anthony.perard@citrix.com>
Mon, 5 Jun 2023 15:00:43 +0000 (16:00 +0100)
committerAnthony PERARD <anthony.perard@citrix.com>
Mon, 5 Jun 2023 15:07:05 +0000 (16:07 +0100)
Fixes: f6eac904f682 ("xen-block: implement BlockDevOps->drained_begin()")
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
--
CC: Stefan Hajnoczi <stefanha@redhat.com>
hw/xen/xen-bus.c

index 1e08cf027ab31d7516139ce2964450ca78cc00ee..ece8ec40cd8180cfc13d3cc6fbfe79f7f51db0be 100644 (file)
@@ -923,8 +923,10 @@ void xen_device_unbind_event_channel(XenDevice *xendev,
 
     QLIST_REMOVE(channel, list);
 
-    aio_set_fd_handler(channel->ctx, qemu_xen_evtchn_fd(channel->xeh),
-                       NULL, NULL, NULL, NULL, NULL);
+    if (channel->ctx) {
+        aio_set_fd_handler(channel->ctx, qemu_xen_evtchn_fd(channel->xeh),
+                           NULL, NULL, NULL, NULL, NULL);
+    }
 
     if (qemu_xen_evtchn_unbind(channel->xeh, channel->local_port) < 0) {
         error_setg_errno(errp, errno, "xenevtchn_unbind failed");