⬢ DragonFlyBSD Kernel Audit
DF-4784 / fix.diff
← back to finding ↓ download raw
--- a/sys/dev/disk/mmcsd/mmcsd.c
+++ b/sys/dev/disk/mmcsd/mmcsd.c
@@ -309,6 +309,16 @@
 
 	sc = (struct mmcsd_softc *)ap->a_head.a_dev->si_drv1;
 	MMCSD_LOCK(sc);
+	/* While suspended (consumer dead) do not queue without bound. */
+	if (sc->suspend > 0 && sc->running <= 0 &&
+	    bioq_first(&sc->bio_queue) != NULL) {
+		MMCSD_UNLOCK(sc);
+		bp->b_error = ENXIO;
+		bp->b_flags |= B_ERROR;
+		bp->b_resid = bp->b_bcount;
+		biodone(bio);
+		return (0);
+	}
 	if (sc->running > 0 || sc->suspend > 0) {
 		bioqdisksort(&sc->bio_queue, bio);
 		MMCSD_UNLOCK(sc);