Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
To: Shuicheng Lin <shuicheng.lin@intel.com>,
	<intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH 1/2] drm/xe/gsc: Fix double-free of managed BO in error path
Date: Tue, 28 Apr 2026 16:06:19 -0700	[thread overview]
Message-ID: <9fa5d6c0-bcd6-4bd2-854e-4c8f58968dac@intel.com> (raw)
In-Reply-To: <20260427154643.3985760-1-shuicheng.lin@intel.com>



On 4/27/2026 8:46 AM, Shuicheng Lin wrote:
> The error path in xe_gsc_init_post_hwconfig() explicitly frees a BO
> allocated with xe_managed_bo_create_pin_map() via
> xe_bo_unpin_map_no_vm(). Since the managed BO already has a devm
> cleanup action registered, this causes a double-free when devm
> unwinds during probe failure.
>
> Remove the explicit free and let devm handle it, consistent with
> all other xe_managed_bo_create_pin_map() callers.
>
> Fixes: 2e5d47fe7839 ("drm/xe/uc: Use managed bo for HuC and GSC objects")
> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> Assisted-by: Claude:claude-opus-4.6
> Signed-off-by: Shuicheng Lin <shuicheng.lin@intel.com>

Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>

Daniele

> ---
>   drivers/gpu/drm/xe/xe_gsc.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_gsc.c b/drivers/gpu/drm/xe/xe_gsc.c
> index 0d13e357fb43..aab59dc647fb 100644
> --- a/drivers/gpu/drm/xe/xe_gsc.c
> +++ b/drivers/gpu/drm/xe/xe_gsc.c
> @@ -482,8 +482,7 @@ int xe_gsc_init_post_hwconfig(struct xe_gsc *gsc)
>   				 EXEC_QUEUE_FLAG_PERMANENT, 0);
>   	if (IS_ERR(q)) {
>   		xe_gt_err(gt, "Failed to create queue for GSC submission\n");
> -		err = PTR_ERR(q);
> -		goto out_bo;
> +		return PTR_ERR(q);
>   	}
>   
>   	wq = alloc_ordered_workqueue("gsc-ordered-wq", 0);
> @@ -506,8 +505,6 @@ int xe_gsc_init_post_hwconfig(struct xe_gsc *gsc)
>   
>   out_q:
>   	xe_exec_queue_put(q);
> -out_bo:
> -	xe_bo_unpin_map_no_vm(bo);
>   	return err;
>   }
>   


  reply	other threads:[~2026-04-28 23:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-27 15:46 [PATCH 1/2] drm/xe/gsc: Fix double-free of managed BO in error path Shuicheng Lin
2026-04-28 23:06 ` Daniele Ceraolo Spurio [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-04-17 16:18 [PATCH 0/2] drm/xe: Fix double-free of managed BOs in error paths Shuicheng Lin
2026-04-17 16:19 ` [PATCH 1/2] drm/xe/gsc: Fix double-free of managed BO in error path Shuicheng Lin

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=9fa5d6c0-bcd6-4bd2-854e-4c8f58968dac@intel.com \
    --to=daniele.ceraolospurio@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=shuicheng.lin@intel.com \
    /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