summaryrefslogtreecommitdiffstats
path: root/sys/dev/pci
diff options
context:
space:
mode:
authormsmith <msmith@FreeBSD.org>2000-10-09 00:43:45 +0000
committermsmith <msmith@FreeBSD.org>2000-10-09 00:43:45 +0000
commit3f7f525479e7bd8ecf84de7d05ca0644d7807a68 (patch)
treefed8a979fa73e52492b3022148b456a1d4a43bf5 /sys/dev/pci
parent12c1416afe977a7848d0bd1aab42981d69b6933a (diff)
downloadFreeBSD-src-3f7f525479e7bd8ecf84de7d05ca0644d7807a68.zip
FreeBSD-src-3f7f525479e7bd8ecf84de7d05ca0644d7807a68.tar.gz
Validate the PCI bus number that we fetch from our parent, since there's no
guarantee that everything attached to *it* is a PCI bus.
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/pci.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c
index 07c8cd8..c0a4bb8 100644
--- a/sys/dev/pci/pci.c
+++ b/sys/dev/pci/pci.c
@@ -1060,7 +1060,7 @@ pci_add_children(device_t dev, int busno)
static int
pci_probe(device_t dev)
{
- static int once;
+ static int once, busno;
device_set_desc(dev, "PCI bus");
@@ -1073,7 +1073,10 @@ pci_probe(device_t dev)
* number to decide what bus we are probing. We ask the parent
* pcib what our bus number is.
*/
- pci_add_children(dev, pcib_get_bus(dev));
+ busno = pcib_get_bus(dev);
+ if (busno < 0)
+ return ENXIO;
+ pci_add_children(dev, busno);
if (!once) {
make_dev(&pcicdev, 0, UID_ROOT, GID_WHEEL, 0644, "pci");
OpenPOWER on IntegriCloud