From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BF4EA335566; Thu, 28 May 2026 20:11:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779999063; cv=none; b=Ke2cSryU1EccXRrpjdT18Ublabyfee36dhHEcLNtD3ef+4l0KLL8S7z4o4cwmzJA3+vTdpODmbdbwMqsezbdqXizAMmdzlaA9PiBDO0xUulWpxjStegtKy+LOLaQs70UJcnMDf5rbA9Xy/ioGGuHeDfSU/ZWPkoVsXMnjno07b4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779999063; c=relaxed/simple; bh=CC0Pbw0yljHaqHa+PerGKw8wm6zEmuW9F6M2R3kpBTg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jAT3orHs1rJGf2InJB4BZkk6S0ZFeK27pLQx7kvnEyh806U6//vqikftZKp47Dgpsu7jRdpOV5z7izVNiIPh84zvtVpdA6COp831oKYikUqa2WGD4IdtgJLyemD3ok4rHXxeo+Q7pWIaynzyGgLRWpA1cJPqfNnldB9D/9fBsaI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=NGIQOkNW; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="NGIQOkNW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2857F1F000E9; Thu, 28 May 2026 20:11:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1779999062; bh=OQlzjgYq9SeUMU0ZSUvj5wEVc0onYcxxlwBxcI3lHRk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=NGIQOkNWdXeamxIhm0BhIl68/RRyLt391U1iKTOmOa+cODkkKwSOaoWkHKSCAgY97 8wgivmLVKtRm4jLUKclDZEupnJVNYOo8TZl9wBuaPXSyjXXSDA0xxHIxaYNUTGx657 Iqaitj6frQeo2t37+UK6eQVFeqZu85NiA5n0aWd4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Daniele Ceraolo Spurio , Shuicheng Lin , Rodrigo Vivi , Sasha Levin Subject: [PATCH 7.0 359/461] drm/xe/gsc: Fix double-free of managed BO in error path Date: Thu, 28 May 2026 21:48:08 +0200 Message-ID: <20260528194657.820084345@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260528194646.819809818@linuxfoundation.org> References: <20260528194646.819809818@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.0-stable review patch. If anyone has any objections, please let me know. ------------------ From: Shuicheng Lin [ 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 Assisted-by: Claude:claude-opus-4.6 Link: https://patch.msgid.link/20260511154134.223696-1-shuicheng.lin@intel.com Signed-off-by: Shuicheng Lin (cherry picked from commit 71d61e3e299a17139e47f980a4d6f425b2c59bf7) Signed-off-by: Rodrigo Vivi Signed-off-by: Sasha Levin --- 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 0d13e357fb43c..aab59dc647fbd 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; } -- 2.53.0