Skip to contentSkip to conversation

drm/xe: Fix bo leak in intel_fb_bo_framebuffer_init

PATCH New Maarten Lankhorst 2 participants 2 messages Apr 3, 2024

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm/xe: Fix bo leak in intel_fb_bo_framebuffer_init

Add a unreference bo in the error path, to prevent leaking a bo ref.

Return 0 on success to clarify the success path.

Fixes 44e694958b95 ("drm/xe/display: Implement display support")
Cc <[email protected]> # v6.8+
---
 drivers/gpu/drm/xe/display/intel_fb_bo.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/display/intel_fb_bo.c +6 -2
index b21da7b745a5..a9c1f9885c6b 100644
@@ -31,7 +31,7 @@ int intel_fb_bo_framebuffer_init(struct intel_framebuffer *intel_fb,
 
 	ret = ttm_bo_reserve(&bo->ttm, true, false, NULL);
 	if (ret)
-		return ret;
+		goto err;
 
 	if (!(bo->flags & XE_BO_SCANOUT_BIT)) {
 		/*
@@ -42,12 +42,16 @@ int intel_fb_bo_framebuffer_init(struct intel_framebuffer *intel_fb,
 		 */
 		if (XE_IOCTL_DBG(i915, !list_empty(&bo->ttm.base.gpuva.list))) {
 			ttm_bo_unreserve(&bo->ttm);
-			return -EINVAL;
+			ret = -EINVAL;
+			goto err;
 		}
 		bo->flags |= XE_BO_SCANOUT_BIT;
 	}
 	ttm_bo_unreserve(&bo->ttm);
+	return 0;
 
+err:
+	xe_bo_put(bo);
 	return ret;
 }
 
Signature · 1 line
2.43.0
#1 lore raw

✗ CI.Patch_applied: failure for drm/xe: Fix bo leak in intel_fb_bo_framebuffer_init (rev2)

== Series Details ==

== Series Details ==

Series: drm/xe: Fix bo leak in intel_fb_bo_framebuffer_init (rev2)
URL : https://patchwork.freedesktop.org/series/131429/
State : failure

== Summary ==

=== Applying kernel patches on branch 'drm-tip' with base: ===
Base commit: 23e6199ddb93 drm-tip: 2024y-04m-03d-07h-14m-06s UTC integration manifest === git am output follows ===
error: patch failed: drivers/gpu/drm/xe/display/intel_fb_bo.c:31
error: drivers/gpu/drm/xe/display/intel_fb_bo.c: patch does not apply
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Applying: drm/xe: Fix bo leak in intel_fb_bo_framebuffer_init
Patch failed at 0001 drm/xe: Fix bo leak in intel_fb_bo_framebuffer_init When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".