[PATCH 1/1] PCI/MSI: add NULL check before use of msi_desc
Hiraku Toyooka
hiraku.toyooka at cybertrust.co.jp
Tue Jan 16 01:15:47 PST 2018
On starting kdump kernel in arm, arm64 and powerpc, chip->irq_mask() is
called for each irq_data to mask interrupts. For MSI irqs,
pci_msi_mask_irq() is called even when the irq_data doesn't have a link
to msi_desc. This results in a NULL pointer dereference.
This patch fixes the above error by avoiding NULL msi_desc use.
Signed-off-by: Hiraku Toyooka <hiraku.toyooka at cybertrust.co.jp>
Cc: Bjorn Helgaas <bhelgaas at google.com>
Cc: Richard Zhu <hongxing.zhu at nxp.com>
Cc: Lucas Stach <l.stach at pengutronix.de>
Cc: Jingoo Han <jingoohan1 at gmail.com>
Cc: Joao Pinto <Joao.Pinto at synopsys.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi at arm.com>
Cc: Russell King <linux at armlinux.org.uk>
Cc: Will Deacon <will.deacon at arm.com>
---
drivers/pci/msi.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index e066071..a6ee274 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -227,6 +227,9 @@ static void msi_set_mask_bit(struct irq_data *data, u32 flag)
{
struct msi_desc *desc = irq_data_get_msi_desc(data);
+ if (!desc)
+ return;
+
if (desc->msi_attrib.is_msix) {
msix_mask_irq(desc, flag);
readl(desc->mask_base); /* Flush write to device */
--
2.7.4
More information about the linux-arm-kernel
mailing list