PCI/MSI: Check for MSI enabled in __pci_msix_enable()

PCI/MSI and PCI/MSI-X are mutually exclusive, but the MSI-X enable code
lacks a check for already enabled MSI.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Ashok Raj <ashok.raj@intel.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://lore.kernel.org/r/20221111122013.653556720@linutronix.de
This commit is contained in:
Thomas Gleixner 2022-11-11 14:54:15 +01:00
parent fd19ce7799
commit fe97f59a78
1 changed files with 5 additions and 0 deletions

View File

@ -935,6 +935,11 @@ static int __pci_enable_msix_range(struct pci_dev *dev,
if (maxvec < minvec)
return -ERANGE;
if (dev->msi_enabled) {
pci_info(dev, "can't enable MSI-X (MSI already enabled)\n");
return -EINVAL;
}
if (WARN_ON_ONCE(dev->msix_enabled))
return -EINVAL;