From: Jesper Juhl Date: Mon, 4 Dec 2006 23:14:48 +0000 (-0800) Subject: PCI: Be a bit defensive in quirk_nvidia_ck804() so we don't risk dereferencing a... X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9ac0ce8596b17093739d42721cc8a616cedf734b;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git PCI: Be a bit defensive in quirk_nvidia_ck804() so we don't risk dereferencing a NULL pdev. pci_get_slot() may return NULL if nothing was found. quirk_nvidia_ck804() does not check the value returned from pci_get_slot(), so it may end up causing a NULL pointer deref. Signed-off-by: Jesper Juhl Acked-by: Alan Cox Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 30c41fc1c996..8a2db01b903e 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -1743,6 +1743,8 @@ static void __devinit quirk_nvidia_ck804_msi_ht_cap(struct pci_dev *dev) * a single one having MSI is enough to be sure that MSI are supported. */ pdev = pci_get_slot(dev->bus, 0); + if (!pdev) + return; if (!msi_ht_cap_enabled(dev) && !msi_ht_cap_enabled(pdev)) { printk(KERN_WARNING "PCI: MSI quirk detected. " "MSI disabled on chipset %s.\n",