kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vfio: call irq_bypass_unregister_producer() before freeing irq
@ 2019-11-27 16:49 Jiang Yi
  2019-11-27 18:20 ` Marc Zyngier
  2019-11-28 10:01 ` Auger Eric
  0 siblings, 2 replies; 4+ messages in thread
From: Jiang Yi @ 2019-11-27 16:49 UTC (permalink / raw)
  To: kvm; +Cc: adulea, jschoenh, maz, alex.williamson, cohuck, Jiang Yi

Since irq_bypass_register_producer() is called after request_irq(), we
should do tear-down in reverse order: irq_bypass_unregister_producer()
then free_irq().

Signed-off-by: Jiang Yi <giangyi@amazon.com>
---
 drivers/vfio/pci/vfio_pci_intrs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/vfio/pci/vfio_pci_intrs.c b/drivers/vfio/pci/vfio_pci_intrs.c
index 3fa3f728fb39..2056f3f85f59 100644
--- a/drivers/vfio/pci/vfio_pci_intrs.c
+++ b/drivers/vfio/pci/vfio_pci_intrs.c
@@ -289,18 +289,18 @@ static int vfio_msi_set_vector_signal(struct vfio_pci_device *vdev,
 	int irq, ret;
 
 	if (vector < 0 || vector >= vdev->num_ctx)
 		return -EINVAL;
 
 	irq = pci_irq_vector(pdev, vector);
 
 	if (vdev->ctx[vector].trigger) {
-		free_irq(irq, vdev->ctx[vector].trigger);
 		irq_bypass_unregister_producer(&vdev->ctx[vector].producer);
+		free_irq(irq, vdev->ctx[vector].trigger);
 		kfree(vdev->ctx[vector].name);
 		eventfd_ctx_put(vdev->ctx[vector].trigger);
 		vdev->ctx[vector].trigger = NULL;
 	}
 
 	if (fd < 0)
 		return 0;
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-12-02 23:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-27 16:49 [PATCH] vfio: call irq_bypass_unregister_producer() before freeing irq Jiang Yi
2019-11-27 18:20 ` Marc Zyngier
2019-12-02 23:14   ` Alex Williamson
2019-11-28 10:01 ` Auger Eric

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).