From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 41AAD175A80; Mon, 23 Mar 2026 14:42:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774276973; cv=none; b=ftsfT4nCjfZX222RJ1VCRg5MHjx6Auf7rQ5xzUt0x+fAahUOCbhpscTMd6LyjJpi1jmDZG+9Y5f/e/3K1gdP8+uiKBFE9pgMNO1V3hj110nlHz+rMKGsk/alMd4hjQmCl2KbwJDA5VOmqXm0lVDUGhI+/hH62BuIWim3B1SihLk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774276973; c=relaxed/simple; bh=phoM960jdKiZUxvPKJwtVPrz3NDC9lN7aTHPpIy/hQM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=m72TxIPqzSXumCGbVMK+pi87q8AwLPd8tsXVK2HrnmLMftdbObj7olj66PzKDnYO7ZQ3TdKR4rDjUgE8UZpxUFcPGyWEII2bUqZlDRgT+tDaASCVdfnX89jqRZA4kuMTpd1Iz1xMAetCo5EJzlTWviXFAk/0oLaJRLTizTwd4zk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=HhgL/Dtw; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="HhgL/Dtw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CBE0AC4CEF7; Mon, 23 Mar 2026 14:42:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1774276973; bh=phoM960jdKiZUxvPKJwtVPrz3NDC9lN7aTHPpIy/hQM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HhgL/DtwXNCbaBejUCKMuxaw2jTs17i1ZSiZopFin1EEckytVCJe6jix3yF4hO3VZ dJxYEro92Fhl/CQA1OoAZtV/KbHN/XM7GtG4qGNtbMQNEXB7PM4MFU+mo9IKvkOarT 0DRGccsJHFgBZx5yyymxoBut/7bHK59klIlnDwig= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Matthew Brost , Shuicheng Lin , Rodrigo Vivi Subject: [PATCH 6.12 273/460] drm/xe/sync: Cleanup partially initialized sync on parse failure Date: Mon, 23 Mar 2026 14:44:29 +0100 Message-ID: <20260323134533.192564336@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260323134526.647552166@linuxfoundation.org> References: <20260323134526.647552166@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Shuicheng Lin commit 1bfd7575092420ba5a0b944953c95b74a5646ff8 upstream. xe_sync_entry_parse() can allocate references (syncobj, fence, chain fence, or user fence) before hitting a later failure path. Several of those paths returned directly, leaving partially initialized state and leaking refs. Route these error paths through a common free_sync label and call xe_sync_entry_cleanup(sync) before returning the error. Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs") Cc: Matthew Brost Signed-off-by: Shuicheng Lin Reviewed-by: Matthew Brost Signed-off-by: Matthew Brost Link: https://patch.msgid.link/20260219233516.2938172-5-shuicheng.lin@intel.com (cherry picked from commit f939bdd9207a5d1fc55cced5459858480686ce22) Cc: stable@vger.kernel.org Signed-off-by: Rodrigo Vivi Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/xe/xe_sync.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) --- a/drivers/gpu/drm/xe/xe_sync.c +++ b/drivers/gpu/drm/xe/xe_sync.c @@ -142,8 +142,10 @@ int xe_sync_entry_parse(struct xe_device if (!signal) { sync->fence = drm_syncobj_fence_get(sync->syncobj); - if (XE_IOCTL_DBG(xe, !sync->fence)) - return -EINVAL; + if (XE_IOCTL_DBG(xe, !sync->fence)) { + err = -EINVAL; + goto free_sync; + } } break; @@ -163,17 +165,21 @@ int xe_sync_entry_parse(struct xe_device if (signal) { sync->chain_fence = dma_fence_chain_alloc(); - if (!sync->chain_fence) - return -ENOMEM; + if (!sync->chain_fence) { + err = -ENOMEM; + goto free_sync; + } } else { sync->fence = drm_syncobj_fence_get(sync->syncobj); - if (XE_IOCTL_DBG(xe, !sync->fence)) - return -EINVAL; + if (XE_IOCTL_DBG(xe, !sync->fence)) { + err = -EINVAL; + goto free_sync; + } err = dma_fence_chain_find_seqno(&sync->fence, sync_in.timeline_value); if (err) - return err; + goto free_sync; } break; @@ -207,6 +213,10 @@ int xe_sync_entry_parse(struct xe_device sync->timeline_value = sync_in.timeline_value; return 0; + +free_sync: + xe_sync_entry_cleanup(sync); + return err; } int xe_sync_entry_add_deps(struct xe_sync_entry *sync, struct xe_sched_job *job)