⬢ DragonFlyBSD Kernel Audit
DF-4228 / fix.diff
← back to finding ↓ download raw
--- a/sys/dev/smbus/cyapa/cyapa.c
+++ b/sys/dev/smbus/cyapa/cyapa.c
@@ -1197,6 +1197,12 @@
 			}
 			smbus_release_bus(bus, sc->dev);
 		}
+		/*
+		 * DF-4228: debug.cyapa_*_freq sysctls are RW and
+		 * unbounded; avoid divide-by-zero / negative timeouts.
+		 */
+		if (freq < 1)
+			freq = 1;
 		tsleep(&sc->poll_flags, 0, "cyapw", (hz + freq - 1) / freq);
 		++sc->poll_ticks;
 		if (sc->count == 0) {