From 5df0e734b8c39598effe0f17e5bd8ff7748a0693 Mon Sep 17 00:00:00 2001 From: Vishnu Dasa Date: Thu, 17 Mar 2022 22:58:43 -0700 Subject: VMCI: Check exclusive_vectors when freeing interrupt 1 free_irq() may be called to free an interrupt that was not allocated. Add missing 'if' statement to check for exclusive_vectors when freeing interrupt 1. Fixes: cc68f2177fcb ("VMCI: dma dg: register dummy IRQ handlers for DMA datagrams") Reported-by: Dan Carpenter Reviewed-by: Bryan Tan Reviewed-by: Rajesh Jalisatgi Signed-off-by: Vishnu Dasa Link: https://lore.kernel.org/r/20220318055843.30606-1-vdasa@vmware.com Signed-off-by: Greg Kroah-Hartman --- drivers/misc/vmw_vmci/vmci_guest.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'drivers/misc') diff --git a/drivers/misc/vmw_vmci/vmci_guest.c b/drivers/misc/vmw_vmci/vmci_guest.c index 981b19308e6f..c8181467d4c5 100644 --- a/drivers/misc/vmw_vmci/vmci_guest.c +++ b/drivers/misc/vmw_vmci/vmci_guest.c @@ -862,7 +862,9 @@ static int vmci_guest_probe_device(struct pci_dev *pdev, return 0; err_free_bm_irq: - free_irq(pci_irq_vector(pdev, 1), vmci_dev); + if (vmci_dev->exclusive_vectors) + free_irq(pci_irq_vector(pdev, 1), vmci_dev); + err_free_irq: free_irq(pci_irq_vector(pdev, 0), vmci_dev); tasklet_kill(&vmci_dev->datagram_tasklet); -- cgit v1.2.3