⬢ DragonFlyBSD Kernel Audit
DF-4730 / fix.diff
← back to finding ↓ download raw
--- a/sys/dev/apple/smc/smc_io.c
+++ b/sys/dev/apple/smc/smc_io.c
@@ -616,6 +616,16 @@
 	if (!sc->sc_sms_intr_works)
 		return;
 
+	/*
+	 * The int-status port exists only on the ISA-port backend.  On the
+	 * MMIO backend sc->sc_ioport is NULL by construction (smc.c never
+	 * allocates it when sc_is_mmio is set), and reading it would panic
+	 * in interrupt context.  MMIO/T2 machines report events by other
+	 * means; nothing to sample here.
+	 */
+	if (sc->sc_ioport == NULL)
+		return;
+
 	SMC_LOCK(sc);
 	type = ASMC_INTPORT_READ(sc);
 	sc->sc_sms_intrtype = type;