All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PCI/MSI: pci_irq_get_affinity() should cope with NULL affinity vector
@ 2016-11-08  7:43 Jan Beulich
  2016-11-08 14:59 ` Christoph Hellwig
  2016-11-08 21:53 ` Bjorn Helgaas
  0 siblings, 2 replies; 4+ messages in thread
From: Jan Beulich @ 2016-11-08  7:43 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: tglx, hch, linux-pci

msi_setup_entry() only logs a message when the affinity vector can't be
allocated, and hence pci_irq_get_affinity() indexing entry->affinity is
wrong without a prior check.

Fixes: ee8d41e53efe "pci/msi: Retrieve affinity for a vector"
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Christoph Hellwig <hch@lst.de>
---
 drivers/pci/msi.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- 4.9-rc4/drivers/pci/msi.c
+++ 4.9-rc4-PCI-MSI-no-affinity/drivers/pci/msi.c
@@ -1294,7 +1294,8 @@ const struct cpumask *pci_irq_get_affini
 	} 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];




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-11-08 21:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-08  7:43 [PATCH] PCI/MSI: pci_irq_get_affinity() should cope with NULL affinity vector Jan Beulich
2016-11-08 14:59 ` Christoph Hellwig
2016-11-08 15:15   ` Jan Beulich
2016-11-08 21:53 ` Bjorn Helgaas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.