[PATCH] pci: fix next_ari_fn scan

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



got

[   29.939191] pci 0000:08:00.0: calling quirk_resource_alignment+0x0/0x1aa
[   29.951060] BUG: unable to handle kernel NULL pointer dereference at 00000000000003d0
[   29.959986] IP: [<ffffffff81542551>] pci_find_ext_capability+0x16/0xa9
...
[   30.229419] Call Trace:
[   30.233810]  [<ffffffff8154080f>] next_ari_fn+0x1b/0x41
[   30.240390]  [<ffffffff815407f4>] ? next_ari_fn+0x0/0x41
[   30.250327]  [<ffffffff815407f4>] ? next_ari_fn+0x0/0x41
[   30.259708]  [<ffffffff81541604>] pci_scan_slot+0xd7/0x11e
[   30.270569]  [<ffffffff81ccb498>] pci_scan_child_bus+0x5c/0x13c
[   30.281684]  [<ffffffff81ccb102>] pci_scan_bridge+0x1ab/0x4e5
[   30.294216]  [<ffffffff81ccaba7>] ? pci_read_bridge_bases+0x16/0x3c6
[   30.306476]  [<ffffffff81ccb523>] pci_scan_child_bus+0xe7/0x13c
[   30.314494]  [<ffffffff81d04504>] pci_acpi_scan_root+0x179/0x1da
[   30.328273]  [<ffffffff81ccd638>] acpi_pci_root_add+0x1bd/0x2bd
[   30.339462]  [<ffffffff8156c2dd>] acpi_device_probe+0x50/0x18a
...
[   30.594901] RIP  [<ffffffff81542551>] pci_find_ext_capability+0x16/0xa9
[   30.600594]  RSP <ffff883ff3d35a10>
[   30.610297] CR2: 00000000000003d0
[   30.613716] ---[ end trace 4eaa2a86a8e2da22 ]---

check if dev is null in that function.

Signed-off-by: Yinghai Lu <yinghai@xxxxxxxxxx>

---
 drivers/pci/probe.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Index: linux-2.6/drivers/pci/probe.c
===================================================================
--- linux-2.6.orig/drivers/pci/probe.c
+++ linux-2.6/drivers/pci/probe.c
@@ -1234,7 +1234,11 @@ EXPORT_SYMBOL(pci_scan_single_device);
 static unsigned next_ari_fn(struct pci_dev *dev, unsigned fn)
 {
 	u16 cap;
-	unsigned pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ARI);
+	unsigned pos;
+
+	if (!dev)
+		return 0;
+	pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ARI);
 	if (!pos)
 		return 0;
 	pci_read_config_word(dev, pos + 4, &cap);
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux