[PATCH v2] drm/i915: fix kref leak in __live_active_setup error path

From: WenTao Liang

Date: Sun Jun 28 2026 - 10:16:56 EST


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 <gregkh@xxxxxxxxxxxxxxxxxxx>
Fixes: 5361db1a33c7 ("drm/i915: Track i915_active using debugobjects")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: WenTao Liang <vulab@xxxxxxxxxxx>
---
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)