drm/xe: Fix bo leak in intel_fb_bo_framebuffer_init
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.
--- 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
@@ -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
Patchwork
CI✗ 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".