⬢ DragonFlyBSD Kernel Audit
DF-4882 / fix.diff
← back to finding ↓ download raw
--- a/sys/dev/netif/ath/ath_rate/onoe/onoe.c
+++ b/sys/dev/netif/ath/ath_rate/onoe/onoe.c
@@ -280,9 +280,14 @@ ath_rate_ctl_start(struct ath_softc *sc, struct ieee80211_node *ni)
 	const struct ieee80211_txparam *tp = ni->ni_txparms;
 	int srate;
 
-	KASSERT(ni->ni_rates.rs_nrates > 0, ("no rates"));
+	/*
+	 * Orphaned/adhoc nodes may legitimately have no negotiated rate
+	 * set (empty Supported Rates IE in the peer's beacon).  This is
+	 * not fatal: ath_rate_update() already handles the empty case and
+	 * the comment below documents it.  Do not KASSERT here -- INVARIANTS
+	 * is enabled in the default X86_64_GENERIC kernel, so the assert is
+	 * a remotely-triggerable panic for a rate-less IBSS neighbor.
+	 */
+	if (ni->ni_rates.rs_nrates == 0)
+		return;
 	if (tp == NULL || tp->ucastrate == IEEE80211_FIXED_RATE_NONE) {