summaryrefslogtreecommitdiff
path: root/drivers/pci
diff options
context:
space:
mode:
authorJan Beulich <JBeulich@suse.com>2016-11-08 10:43:54 +0300
committerBjorn Helgaas <bhelgaas@google.com>2016-11-09 00:35:17 +0300
commitd1d111e073840b8dbc1ae90ba3fc274736451bdc (patch)
tree466bcceba53fe029c80f581242e388064ab23fa4 /drivers/pci
parent1001354ca34179f3db924eb66672442a173147dc (diff)
downloadlinux-d1d111e073840b8dbc1ae90ba3fc274736451bdc.tar.xz
PCI/MSI: Check for NULL affinity mask in pci_irq_get_affinity()
If msi_setup_entry() fails to allocate an affinity mask, it logs a message but continues on and allocates an MSI entry with entry->affinity == NULL. Check for this case in pci_irq_get_affinity() so we don't try to dereference a NULL pointer. [bhelgaas: changelog] Fixes: ee8d41e53efe "pci/msi: Retrieve affinity for a vector" Signed-off-by: Jan Beulich <jbeulich@suse.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Christoph Hellwig <hch@lst.de> CC: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/msi.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index bfdd0744b686..da4e3c1248db 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -1292,7 +1292,8 @@ const struct cpumask *pci_irq_get_affinity(struct pci_dev *dev, int nr)
} else if (dev->msi_enabled) {
struct msi_desc *entry = first_pci_msi_entry(dev);
- if (WARN_ON_ONCE(!entry || nr >= entry->nvec_used))
+ if (WARN_ON_ONCE(!entry || !entry->affinity ||
+ nr >= entry->nvec_used))
return NULL;
return &entry->affinity[nr];