From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 78D433F4DF0 for ; Mon, 29 Jun 2026 09:00:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782723627; cv=none; b=HekkO3cLOok46EzyfPY6Vx4LULM5LH4KKqeRoi617SW5w2wUDTBhHrzgg5oQkj8n2VjqqRLksHNV6T5qieY3ZrzkKdA5aQiNnTmGtHDSKoj7CrcXfiRljxB4zg1oUWuXJS6AQB97UeD4kk7PRsANsC22Sa3eGbkib8+o+ZtLsmM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782723627; c=relaxed/simple; bh=QV1Oipki3O6lDO1YTL1XjnrOZLHYeMd1B5VY3Lh9Za4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NKKuDKxDi1BXbALoXiTxkBXG8oLVDmRmsCeOIIW2s0Utdjo9lN+EvHShafwD57CO2l23NgfBease3HO10Ov4zuNgj9KAbBGAquhYpf2v/jvdjz4/tDdkuPIJbgc3MtE/H+egATGcQIS1/yeCaroXNiYgetg5/knEmY3wH8WxnOk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=b5ICQrhk; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="b5ICQrhk" Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9F8841A00; Mon, 29 Jun 2026 02:00:21 -0700 (PDT) Received: from e129823.cambridge.arm.com (e129823.arm.com [10.2.213.3]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 5015F3F836; Mon, 29 Jun 2026 02:00:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1782723626; bh=QV1Oipki3O6lDO1YTL1XjnrOZLHYeMd1B5VY3Lh9Za4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b5ICQrhkxW/zTsspYuVP0twrAlSKxr+4XpamlcpicNNDHHYWr466HETC35txE2m57 Pt1CHFd+Mcpnr4il2w0mAp08cocUmyroD+aLcvURx1SMH2JMD9soFGuQmxy+jwfj9q J5EZZGKgZVMt+9SmaAb1Mhr5eWoxFGzBXU7GAFrY= From: Yeoreum Yun To: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: suzuki.poulose@arm.com, mike.leach@arm.com, james.clark@linaro.org, alexander.shishkin@linux.intel.com, leo.yan@arm.com, jie.gan@oss.qualcomm.com, Yeoreum Yun Subject: [PATCH v8 07/13] coresight: etm4x: fix leaked trace id Date: Mon, 29 Jun 2026 10:00:00 +0100 Message-ID: <20260629090007.1718746-8-yeoreum.yun@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260629090007.1718746-1-yeoreum.yun@arm.com> References: <20260629090007.1718746-1-yeoreum.yun@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit If etm4_enable_sysfs() fails in cscfg_csdev_enable_active_config(), the trace ID may be leaked because it is not released. To address this, call etm4_release_trace_id() when etm4_enable_sysfs() fails in cscfg_csdev_enable_active_config(). Fixes: 7ebd0ec6cf94 ("coresight: configfs: Allow configfs to activate configuration") Reviewed-by: Jie Gan Reviewed-by: Leo Yan Signed-off-by: Yeoreum Yun --- drivers/hwtracing/coresight/coresight-etm4x-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c index faa00dcd03a7..2798604943ed 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -929,8 +929,10 @@ static int etm4_enable_sysfs(struct coresight_device *csdev, struct coresight_pa cscfg_config_sysfs_get_active_cfg(&cfg_hash, &preset); if (cfg_hash) { ret = cscfg_csdev_enable_active_config(csdev, cfg_hash, preset); - if (ret) + if (ret) { + etm4_release_trace_id(drvdata); return ret; + } } raw_spin_lock(&drvdata->spinlock); -- LEVI:{C3F47F37-75D8-414A-A8BA-3980EC8A46D7}