⬢ DragonFlyBSD Kernel Audit
DF-4878 / fix.diff
← back to finding ↓ download raw
--- a/sys/dev/drm/amd/display/dc/i2caux/i2caux.c	2026-09-24 17:15:01.464690338 +0000
+++ b/sys/dev/drm/amd/display/dc/i2caux/i2caux.c	2026-09-24 17:15:53.956007860 +0000
@@ -423,7 +423,15 @@
 {
 	engine->funcs->release_engine(engine);
 
-	dal_ddc_close(engine->ddc);
+	/*
+	 * engine->ddc is owned unsynchronized state (DAL2 holds a mutex
+	 * across acquire..submit..release; this port does not), so a
+	 * concurrent release can already have closed the ddc and stored
+	 * NULL here.  dal_ddc_close() dereferences its argument without a
+	 * NULL check — guard it.  (DF-4878)
+	 */
+	if (engine->ddc)
+		dal_ddc_close(engine->ddc);
 
 	engine->ddc = NULL;
 }