stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nirmoy Das <nirmoy.das@linux.intel.com>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	intel-xe@lists.freedesktop.org
Cc: stable@vger.kernel.org
Subject: Re: [PATCH] drm/xe: Fix bo leak in intel_fb_bo_framebuffer_init
Date: Mon, 8 Apr 2024 12:13:06 +0200	[thread overview]
Message-ID: <c86e90ef-5bee-4638-9dcd-2666bb7f6e51@linux.intel.com> (raw)
In-Reply-To: <20240404090302.68422-1-maarten.lankhorst@linux.intel.com>


On 4/4/2024 11:03 AM, Maarten Lankhorst wrote:
> Add a unreference bo in the error path, to prevent leaking a bo ref.
>
> Return 0 on success to clarify 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+
Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>
> ---
>   drivers/gpu/drm/xe/display/intel_fb_bo.c | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/display/intel_fb_bo.c b/drivers/gpu/drm/xe/display/intel_fb_bo.c
> index dba327f53ac5..e18521acc516 100644
> --- a/drivers/gpu/drm/xe/display/intel_fb_bo.c
> +++ b/drivers/gpu/drm/xe/display/intel_fb_bo.c
> @@ -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_FLAG_SCANOUT)) {
>   		/*
> @@ -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_FLAG_SCANOUT;
>   	}
>   	ttm_bo_unreserve(&bo->ttm);
> +	return 0;
>   
> +err:
> +	xe_bo_put(bo);
>   	return ret;
>   }
>   

  reply	other threads:[~2024-04-08 10:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-04  9:03 [PATCH] drm/xe: Fix bo leak in intel_fb_bo_framebuffer_init Maarten Lankhorst
2024-04-08 10:13 ` Nirmoy Das [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-03-21 14:56 Maarten Lankhorst
2024-03-21 19:56 ` Rodrigo Vivi
2024-03-22 16:16   ` Lucas De Marchi

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=c86e90ef-5bee-4638-9dcd-2666bb7f6e51@linux.intel.com \
    --to=nirmoy.das@linux.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).