⬢ DragonFlyBSD Kernel Audit
DF-5648 / fix.diff
← back to finding ↓ download raw
--- a/sys/bus/isa/isahint.c
+++ b/sys/bus/isa/isahint.c
@@ -88,6 +88,7 @@
 static int
 isahint_identify(driver_t *driver, device_t parent)
 {
+	devclass_t	isa_dc;
 	int i;
 	static char buf[] = "isaXXX";
 
@@ -116,6 +117,19 @@
 	}
 
 	/*
+	 * Only enumerate the generic "at isa" hints on the first ISA bus.
+	 * When more than one ISA bus exists (e.g. an ACPI generic container
+	 * claiming isab0/isa0 next to the real PCI-ISA bridge's isa1 --
+	 * see isab_attach()'s wired unit-0 child and acpi_isab's PNP0A05/06
+	 * match), enumerating on every bus would create duplicate device
+	 * instances for the same physical hardware, with renumbered units
+	 * (devclass_alloc_unit() silently takes the next free unit).
+	 */
+	isa_dc = devclass_find("isa");
+	if (isa_dc == NULL || devclass_get_device(isa_dc, 0) != parent)
+		return (0);
+
+	/*
 	 * and isa?
 	 */
 	for (i = resource_query_string(-1, "at", "isa");