From e1992aa14269215d7fd76eaef994e07866c70be2 Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Thu, 22 Mar 2018 12:26:27 +0000 Subject: [PATCH] Clear old MSIX IRQ numbers in the LinuxKPI. When disabling the MSIX IRQ vectors for a PCI device through the LinuxKPI, make sure any old MSIX IRQ numbers are no longer visible to the linux_pci_find_irq_dev() function else IRQs can be requested from the wrong PCI device. MFC after: 1 week Sponsored by: Mellanox Technologies --- sys/compat/linuxkpi/common/include/linux/pci.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h index 70e62b0a7db9..d5d621cd1a3e 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -425,6 +425,15 @@ pci_disable_msix(struct pci_dev *pdev) { pci_release_msi(pdev->dev.bsddev); + + /* + * The MSIX IRQ numbers associated with this PCI device are no + * longer valid and might be re-assigned. Make sure + * linux_pci_find_irq_dev() does no longer see them by + * resetting their references to zero: + */ + pdev->dev.msix = 0; + pdev->dev.msix_max = 0; } static inline bus_addr_t