⬢ DragonFlyBSD Kernel Audit
DF-4546 / fix.diff
← back to finding ↓ download raw
--- a/sys/dev/powermng/lm/lm78.c
+++ b/sys/dev/powermng/lm/lm78.c
@@ -447,6 +447,15 @@
 {
 	int i;
 
+	/*
+	 * Chips matched without a sensor table (e.g. the W83791SD,
+	 * wb_match() lm78.c:590) attach with numsensors == 0 and never
+	 * install the sensordev -- deinstalling it would TAILQ_REMOVE a
+	 * node that was never inserted (DF-4546).
+	 */
+	if (sc->numsensors == 0)
+		return (0);
+
 	/* Remove sensors */
 	sensordev_deinstall(&sc->sensordev);
 	for (i = 0; i < sc->numsensors; i++)