When heap_fence_create fails, the early error path calls kfree(active)
directly instead of __live_put(active), bypassing the kref_put path that
would call i915_active_fini for proper resource teardown. This skips
cleanup of the i915_active state while the initial kref from kref_init
remains unbalanced.

Suggested-by: Greg KH <[email protected]>
Fixes: 5361db1a33c7 ("drm/i915: Track i915_active using debugobjects")
Cc: [email protected]
Signed-off-by: WenTao Liang <[email protected]>
---
Changes in v2:
- Fix patch format based on reviewer feedback
---
 drivers/gpu/drm/i915/selftests/i915_active.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/selftests/i915_active.c 
b/drivers/gpu/drm/i915/selftests/i915_active.c
index 9fea2fabeac4..8ec7859da762 100644
--- a/drivers/gpu/drm/i915/selftests/i915_active.c
+++ b/drivers/gpu/drm/i915/selftests/i915_active.c
@@ -91,7 +91,7 @@ __live_active_setup(struct drm_i915_private *i915)
 
        submit = heap_fence_create(GFP_KERNEL);
        if (!submit) {
-               kfree(active);
+               __live_put(active);
                return ERR_PTR(-ENOMEM);
        }
 
-- 
2.39.5 (Apple Git-154)

Reply via email to