[PATCH 11/13] VMCI: Check exclusive_vectors when freeing interrupt 1

Tim Gardner tim.gardner at canonical.com
Tue Jun 14 19:06:16 UTC 2022

From: Vishnu Dasa <vdasa at vmware.com>

BugLink: https://bugs.launchpad.net/bugs/1978145

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 <dan.carpenter at oracle.com>
Reviewed-by: Bryan Tan <bryantan at vmware.com>
Reviewed-by: Rajesh Jalisatgi <rjalisatgi at vmware.com>
Signed-off-by: Vishnu Dasa <vdasa at vmware.com>
Link: https://lore.kernel.org/r/20220318055843.30606-1-vdasa@vmware.com
Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
(cherry picked from commit 5df0e734b8c39598effe0f17e5bd8ff7748a0693)
Signed-off-by: Tim Gardner <tim.gardner at canonical.com>
 drivers/misc/vmw_vmci/vmci_guest.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/vmw_vmci/vmci_guest.c b/drivers/misc/vmw_vmci/vmci_guest.c
index 3fcbf07517ae..a226d638d11c 100644
--- a/drivers/misc/vmw_vmci/vmci_guest.c
+++ b/drivers/misc/vmw_vmci/vmci_guest.c
@@ -864,7 +864,9 @@ static int vmci_guest_probe_device(struct pci_dev *pdev,
 	return 0;
-	free_irq(pci_irq_vector(pdev, 1), vmci_dev);
+	if (vmci_dev->exclusive_vectors)
+		free_irq(pci_irq_vector(pdev, 1), vmci_dev);
 	free_irq(pci_irq_vector(pdev, 0), vmci_dev);

More information about the kernel-team mailing list