DragonFlyBSD Kernel Audit
DF-0999 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/bus/u4b/wlan/if_rum.c b/sys/bus/u4b/wlan/if_rum.c
@@ -2668,6 +2668,17 @@
 
 	RUM_LOCK_ASSERT(sc);
 
+	/*
+	 * vap->iv_bss->ni_intval is copied verbatim from a beacon IE
+	 * (ieee80211_input.c:545) and although net80211 flags the
+	 * value as IEEE80211_BPARSE_BINTVAL_INVALID when it is outside
+	 * [25,1000], that flag is never enforced, so a zero interval
+	 * can reach us here and cause a divide-by-zero (#DE -> panic).
+	 * Treat 0 as 1 to avoid the trap.  See DF-0999.
+	 */
+	if (bintval == 0)
+		bintval = 1;
+
 	exp = ic->ic_lintval / bintval;
 	delay = ic->ic_lintval % bintval;