Re: [PATCH v3 11/12] ACPI: video: convert to acpi_get_pci_dev

From: Alex Chiang
Date: Thu Jun 25 2009 - 19:05:47 EST


Hi Alex,

Thanks for the bug report and sorry for the troubles.

I've already got a debug patch here:

http://thread.gmane.org/gmane.linux.kernel/857228/focus=857468

Perhaps you can try it too?

Len, in the mean time, can you please apply this as an emergency,
"let's not crash anyone else's machine" while I try and figure
out why the ACPI video driver breaks my assumptions?

Troy, I applied your S-o-B, but maybe that was not a good
assumption on my part? To be sure, could you please respond with
your S-o-B?

Thanks.

/ac, wearing a brown paper bag

From: Troy Moure <twmoure@xxxxxxxxx>

ACPI: prevent NULL deref in acpi_get_pci_dev()

When the ACPI video driver initializes, it does a namespace walk
looking for for supported devices. When we find an appropriate
handle, we walk up the ACPI tree looking for a PCI root bus, and
then walk back down the PCI bus, assuming that every device
inbetween is a P2P bridge.

This assumption is not correct, and is reported broken on at
least:

Dell Latitude E6400
ThinkPad X61
Dell XPS M1330

Add a NULL deref check to prevent boot panics.

Reported-by: Alessandro Suardi <alessandro.suardi@xxxxxxxxx>
Signed-off-by: Troy Moure <twmoure@xxxxxxxxx>
Signed-off-by: Alex Chiang <achiang@xxxxxx>
---
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index 8a5bf3b..55b5b90 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -395,7 +395,7 @@ struct pci_dev *acpi_get_pci_dev(acpi_handle handle)
fn = adr & 0xffff;

pdev = pci_get_slot(pbus, PCI_DEVFN(dev, fn));
- if (hnd == handle)
+ if (!pdev || hnd == handle)
break;

pbus = pdev->subordinate;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/