DragonFlyBSD Kernel Audit
DF-1616 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/dev/netif/ath/ath/if_ath_beacon.c b/sys/dev/netif/ath/ath/if_ath_beacon.c
--- a/sys/dev/netif/ath/ath/if_ath_beacon.c
+++ b/sys/dev/netif/ath/ath/if_ath_beacon.c
@@ -477,8 +477,13 @@
 		uint32_t tsftu;
 
 		tsftu = ath_hal_gettsf32(ah) >> 10;
-		/* XXX lintval */
-		slot = ((tsftu % ic->ic_lintval) * ATH_BCBUF) / ic->ic_lintval;
+		/* Guard against zero beacon interval (settable via ioctl). */
+		if (ic->ic_lintval == 0) {
+			slot = 0;
+		} else {
+			/* XXX lintval */
+			slot = ((tsftu % ic->ic_lintval) * ATH_BCBUF) / ic->ic_lintval;
+		}
 		vap = sc->sc_bslot[(slot+1) % ATH_BCBUF];
 		bfaddr = 0;
 		if (vap != NULL && vap->iv_state >= IEEE80211_S_RUN) {