]> git.ipfire.org Git - thirdparty/qemu.git/commit
vfio/pci: Don't remove irqchip notifier if not registered
authorPeter Xu <peterx@redhat.com>
Mon, 6 Jan 2020 20:34:45 +0000 (13:34 -0700)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Tue, 2 Jun 2020 00:41:11 +0000 (19:41 -0500)
commit3fb2521040478adbec767eac83ec6a78ad0c610d
tree950041ea426a2ccd14bf4b220f5342f16faa16b1
parent742195db1746f6c8527ee30a030c0295d7a1eaed
vfio/pci: Don't remove irqchip notifier if not registered

The kvm irqchip notifier is only registered if the device supports
INTx, however it's unconditionally removed.  If the assigned device
does not support INTx, this will cause QEMU to crash when unplugging
the device from the system.  Change it to conditionally remove the
notifier only if the notify hook is setup.

CC: Eduardo Habkost <ehabkost@redhat.com>
CC: David Gibson <david@gibson.dropbear.id.au>
CC: Alex Williamson <alex.williamson@redhat.com>
Cc: qemu-stable@nongnu.org # v4.2
Reported-by: yanghliu@redhat.com
Debugged-by: Eduardo Habkost <ehabkost@redhat.com>
Fixes: c5478fea27ac ("vfio/pci: Respond to KVM irqchip change notifier")
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1782678
Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Greg Kurz <groug@kaod.org>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
(cherry picked from commit 0446f8121723b134ca1d1ed0b73e96d4a0a8689d)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
hw/vfio/pci.c