⬢ DragonFlyBSD Kernel Audit
DF-5162 / fix.diff
← back to finding ↓ download raw
--- a/sys/dev/video/bktr/bktr_core.c
+++ b/sys/dev/video/bktr/bktr_core.c
@@ -1679,6 +1679,13 @@
 				else
 					error = ENOMEM;
 			}
+			/* DF-5162: keep the bktr_mem registry in sync with the live
+			 * allocation. The old buffer was kmem_free()d above; without
+			 * this re-store a driver reload would reinstall the freed
+			 * pointer and bzero()/DMA into it (bktr_core.c:429-432). */
+#if defined(KLD_MODULE)
+			bktr_store_address(unit, BKTR_MEM_BUF, bktr->bigbuf);
+#endif
 		}
 
 		if (error)