From a70e114dc63d643327a31be939105431104ee0cb Mon Sep 17 00:00:00 2001 From: Andriy Gapon Date: Tue, 16 Jul 2019 08:36:49 +0000 Subject: [PATCH] bge: check that the bus is a pci bus before using it as such This fixes the following panic on powerpc: pci_get_vendor failed for pcib1 on bus ofwbus0, error = 2 PR: 238730 Reported by: Dennis Clarke Tested by: Dennis Clarke MFC after: 2 weeks --- sys/dev/bge/if_bge.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/bge/if_bge.c b/sys/dev/bge/if_bge.c index 7ab5cfceca14..bae18acf96ae 100644 --- a/sys/dev/bge/if_bge.c +++ b/sys/dev/bge/if_bge.c @@ -3276,6 +3276,8 @@ bge_mbox_reorder(struct bge_softc *sc) bus = device_get_parent(dev); if (device_get_devclass(dev) != pcib) break; + if (device_get_devclass(bus) != pci) + break; for (i = 0; i < nitems(mbox_reorder_lists); i++) { if (pci_get_vendor(dev) == mbox_reorder_lists[i].vendor && @@ -3287,8 +3289,6 @@ bge_mbox_reorder(struct bge_softc *sc) return (1); } } - if (device_get_devclass(bus) != pci) - break; } return (0); }