]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/xe/gsc: Fix double-free of managed BO in error path
authorShuicheng Lin <shuicheng.lin@intel.com>
Mon, 11 May 2026 15:41:34 +0000 (15:41 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 1 Jun 2026 15:46:30 +0000 (17:46 +0200)
[ Upstream commit d3ded53fab90996e7d94a39049e11962dd066725 ]

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")
Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Assisted-by: Claude:claude-opus-4.6
Link: https://patch.msgid.link/20260511154134.223696-1-shuicheng.lin@intel.com
Signed-off-by: Shuicheng Lin <shuicheng.lin@intel.com>
(cherry picked from commit 71d61e3e299a17139e47f980a4d6f425b2c59bf7)
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/xe/xe_gsc.c

index efc480d34c9dd1148fe243f1f3f968f755e5bb37..6786773f4560b1705c1f88f052b30d9aba4357cf 100644 (file)
@@ -485,8 +485,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);
@@ -509,8 +508,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;
 }