PCI: Be a bit defensive in quirk_nvidia_ck804() so we don't risk dereferencing a...
authorJesper Juhl <jesper.juhl@gmail.com>
Mon, 4 Dec 2006 23:14:48 +0000 (15:14 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 20 Dec 2006 18:54:43 +0000 (10:54 -0800)
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 <jesper.juhl@gmail.com>
Acked-by: Alan Cox <alan@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/pci/quirks.c

index 30c41fc1c99665e9d3c617d756dca433434914fa..8a2db01b903ed19638806ffce24ed0ee9987d7e5 100644 (file)
@@ -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",