[Intel-gfx] [PATCH] drm/i915/uc: Fix double free bug

Dan Carpenter error27 at gmail.com
Tue Nov 29 09:45:31 UTC 2022


The "fw" pointer is freed again in the clean up code at the end of the
function.  Set it to NULL here to prevent a double free.

Fixes: 016241168dc5 ("drm/i915/uc: use different ggtt pin offsets for uc loads")
Signed-off-by: Dan Carpenter <error27 at gmail.com>
---
 drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c b/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c
index 0c80ba51a4bd..8aa9bcae8e72 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c
@@ -585,6 +585,7 @@ int intel_uc_fw_fetch(struct intel_uc_fw *uc_fw)
 
 		/* try to find another blob to load */
 		release_firmware(fw);
+		fw = NULL;
 		err = -ENOENT;
 	}
 
-- 
2.35.1



More information about the Intel-gfx mailing list