⬢ DragonFlyBSD Kernel Audit
DF-5626 / fix.diff
← back to finding ↓ download raw
--- a/sys/bus/ppbus/ppb_base.c	2026-10-08 23:00:10.320518500 +0000
+++ b/sys/bus/ppbus/ppb_base.c	2026-10-08 23:00:23.688345817 +0000
@@ -64,6 +64,16 @@
 			if ((r & mask) == status)
 				return (0);
 		}
+
+		/* keep long PPB_POLL waits preemptible: yield the CPU
+		 * for one tick after each 10ms busy window so the wait
+		 * does not pin the caller's CPU (do_peripheral_wait()
+		 * asks for max=100, i.e. nominally 1s of busy loop) */
+		if ((how & PPB_POLL) && j + 1 < max) {
+			if ((error = tsleep((caddr_t)bus, PCATCH,
+			    "ppbpoll", 1)) != EWOULDBLOCK)
+				return (error);
+		}
 	}
 
 	if (!(how & PPB_POLL)) {