From nobody Sat Jul 25 18:07:00 2026 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (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 6451919F137 for ; Wed, 15 Jul 2026 02:33:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784082826; cv=none; b=bAlbn1Bpbi+gw09D7yeZFFM2JtParJcB3Sccf/f9cDZixMWA0QNdn1CfLtaD0Ubt+rHyqH6N090nMKlqdwp/El8Z6WMIrSW7zoweBAeENvTU3wT25z+qXe/88S3OmkpOdctBeu1NaSqlfduTKeiB+pKvPeG7EOcc/HkioYk+1lo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784082826; c=relaxed/simple; bh=x/in8/CNZB84jYjH/pZoE/17bDIuVwCFwPeE79ny0ik=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=EAb4OnpfZMtxnlCeqdLuDeQJVuaYFuorWPs1dzqPimuJ7MYFuuFDCYbjCkqGXfYk7pJS1iBrLfzYUUZn4ZPnF3p9529x/B8vobgyK91au1/QpwJiOTycw/+10ezC0T4U57Ec+msBFYWTc/KrL38bqHa/iJpvxfYX7DVZJioOCeQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: 956190067ff511f1aa26b74ffac11d73-20260715 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.3.12,REQID:566fa146-affc-4dfc-ab6b-de3f66f77791,IP:0,U RL:0,TC:0,Content:0,EDM:25,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:25 X-CID-META: VersionHash:e7bac3a,CLOUDID:d5487ac373028724d8ab18d1e797cf1b,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:102|136|850|865|898,TC:nil,Content:0|15| 50,EDM:5,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0, OSA:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 2,SSN|SDN X-CID-BAS: 2,SSN|SDN,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-CID-RHF: D41D8CD98F00B204E9800998ECF8427E X-UUID: 956190067ff511f1aa26b74ffac11d73-20260715 X-User: lilinmao@kylinos.cn Received: from localhost.localdomain [(10.44.16.150)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA with TLSv1.3 TLS_AES_256_GCM_SHA384 256/256) with ESMTP id 361048287; Wed, 15 Jul 2026 10:33:37 +0800 From: Linmao Li To: Ashutosh Dixit , Matthew Brost , =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= , Rodrigo Vivi Cc: David Airlie , Simona Vetter , =?UTF-8?q?Jos=C3=A9=20Roberto=20de=20Souza?= , Umesh Nerlige Ramappa , intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Linmao Li Subject: [PATCH] drm/xe/oa: Fix sync entry leak on OA config emit failure Date: Wed, 15 Jul 2026 10:33:32 +0800 Message-Id: <20260715023332.391298-1-lilinmao@kylinos.cn> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" xe_oa_emit_oa_config() releases the sync entries and the syncs array only on its success path. When it fails before the point of no return (fence allocation, config buffer allocation or batch submission), it returns without touching stream->syncs. The stream open path handles such failures in the caller, but xe_oa_config_locked() propagates the error without any cleanup, so the syncs array and the fence references held by the parsed entries are leaked. The next config ioctl overwrites stream->syncs, making the memory unreachable for good. Clean up the parsed syncs when xe_oa_emit_oa_config() fails, matching the cleanup done by the stream open error path, and reset the stream sync state so it does not point at freed entries. Fixes: 9920c8b88c5c ("drm/xe/oa: Add syncs support to OA config ioctl") Signed-off-by: Linmao Li --- drivers/gpu/drm/xe/xe_oa.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/xe/xe_oa.c b/drivers/gpu/drm/xe/xe_oa.c index 2dce6a47202c..b1ce312ea97a 100644 --- a/drivers/gpu/drm/xe/xe_oa.c +++ b/drivers/gpu/drm/xe/xe_oa.c @@ -1594,6 +1594,12 @@ static long xe_oa_config_locked(struct xe_oa_stream = *stream, u64 arg) config =3D xchg(&stream->oa_config, config); drm_dbg(&stream->oa->xe->drm, "changed to oa config uuid=3D%s\n", stream->oa_config->uuid); + } else { + while (param.num_syncs--) + xe_sync_entry_cleanup(¶m.syncs[param.num_syncs]); + kfree(param.syncs); + stream->num_syncs =3D 0; + stream->syncs =3D NULL; } =20 err_config_put: --=20 2.25.1