⬢ DragonFlyBSD Kernel Audit
DF-3835 / fix.diff
← back to finding ↓ download raw
--- a/sys/dev/netif/bwn/bwn/if_bwn_phy_lp.c
+++ b/sys/dev/netif/bwn/bwn/if_bwn_phy_lp.c
@@ -2337,7 +2337,12 @@
 	if (ret == 0)
 		goto done;
 
-	if (ie.ie_ipwr + ie.ie_qpwr < 2) {
+	/*
+	 * DF-3835: CALC_COEFF/CALC_COEFF2 divide by expressions of
+	 * ie.ie_ipwr; the sum guard below does not exclude ie_ipwr == 0
+	 * with ie_qpwr >= 2, which would raise a kernel #DE.
+	 */
+	if (ie.ie_ipwr + ie.ie_qpwr < 2 || ie.ie_ipwr == 0) {
 		ret = 0;
 		goto done;
 	}