⬢ DragonFlyBSD Kernel Audit
DF-5118 / fix.diff
← back to finding ↓ download raw
--- a/sys/dev/misc/dcons/dcons_crom.c
+++ b/sys/dev/misc/dcons/dcons_crom.c
@@ dcons_crom_detach(device_t dev)
 	/* XXX */
 	if (dcons_conf->dma_tag == sc->dma_tag) {
 		dcons_conf->dma_tag = NULL;
+		/* the map belongs to the same instance: clear it too, and
+		 * reset dcons_paddr so a re-attach re-wires dcons_conf
+		 * instead of taking the "already set" early-return in
+		 * dmamap_cb with stale globals. */
+		dcons_conf->dma_map = NULL;
+		dcons_paddr = 0;
 	}
 
 	bus_dmamap_unload(sc->dma_tag, sc->dma_map);