From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: <intel-xe@lists.freedesktop.org>, <stable@vger.kernel.org>
Subject: Re: [PATCH] drm/xe: Fix bo leak in intel_fb_bo_framebuffer_init
Date: Thu, 21 Mar 2024 15:56:23 -0400 [thread overview]
Message-ID: <ZfyQ56P0DtQCNsIW@intel.com> (raw)
In-Reply-To: <20240321145644.33091-1-maarten.lankhorst@linux.intel.com>
On Thu, Mar 21, 2024 at 03:56:44PM +0100, Maarten Lankhorst wrote:
> Add a reference to bo after all error paths, to prevent leaking a bo
> ref.
>
> Return 0 to clarify that this is the success path.
>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Fixes: 44e694958b95 ("drm/xe/display: Implement display support")
> Cc: <stable@vger.kernel.org> # v6.8+
> ---
> drivers/gpu/drm/xe/display/intel_fb_bo.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/display/intel_fb_bo.c b/drivers/gpu/drm/xe/display/intel_fb_bo.c
> index b21da7b745a5..7262bbca9baf 100644
> --- a/drivers/gpu/drm/xe/display/intel_fb_bo.c
> +++ b/drivers/gpu/drm/xe/display/intel_fb_bo.c
> @@ -27,8 +27,6 @@ int intel_fb_bo_framebuffer_init(struct intel_framebuffer *intel_fb,
> struct drm_i915_private *i915 = to_i915(bo->ttm.base.dev);
> int ret;
>
> - xe_bo_get(bo);
> -
> ret = ttm_bo_reserve(&bo->ttm, true, false, NULL);
> if (ret)
> return ret;
> @@ -48,7 +46,8 @@ int intel_fb_bo_framebuffer_init(struct intel_framebuffer *intel_fb,
> }
> ttm_bo_unreserve(&bo->ttm);
>
> - return ret;
> + xe_bo_get(bo);
wouldn't be safer to keep the get in the beginning of everything else
and then if in an error path you xe_bo_put(bo); ?!
> + return 0;
> }
>
> struct xe_bo *intel_fb_bo_lookup_valid_bo(struct drm_i915_private *i915,
> --
> 2.43.0
>
next prev parent reply other threads:[~2024-03-21 19:56 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-21 14:56 [PATCH] drm/xe: Fix bo leak in intel_fb_bo_framebuffer_init Maarten Lankhorst
2024-03-21 16:13 ` ✓ CI.Patch_applied: success for " Patchwork
2024-03-21 16:14 ` ✓ CI.checkpatch: " Patchwork
2024-03-21 16:14 ` ✓ CI.KUnit: " Patchwork
2024-03-21 16:25 ` ✓ CI.Build: " Patchwork
2024-03-21 16:28 ` ✓ CI.Hooks: " Patchwork
2024-03-21 16:29 ` ✓ CI.checksparse: " Patchwork
2024-03-21 16:57 ` ✓ CI.BAT: " Patchwork
2024-03-21 19:56 ` Rodrigo Vivi [this message]
2024-03-22 16:16 ` [PATCH] " Lucas De Marchi
-- strict thread matches above, loose matches on Subject: below --
2024-04-04 9:03 Maarten Lankhorst
2024-04-08 10:13 ` Nirmoy Das
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZfyQ56P0DtQCNsIW@intel.com \
--to=rodrigo.vivi@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.