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 75DF73BED6A for ; Sat, 25 Jul 2026 11:37:03 +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=1784979425; cv=none; b=Qu2OZblS6NKltSVMGLVRcTETlyqg3FZUdlHHzlv+iY7Xq8FrqEj0qKM03T8/VqSj5aM/vGN43yA2inAfghnb7MgIPSFi4uvj47T3K1M2/RIvQ1b3B7jBDuAdccWWX0giHL9CwQoo6lkkPrvmWXWOPVZah9SjSkk7yQBwJWpOShI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784979425; c=relaxed/simple; bh=08jMdtod7Ir4RxqBmMzY3RvBdF+D2iKjLfEjJc2o1Go=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=m906MDkccfd9d3ozlfM85HxhuNF68JS33L/fisLGSGDOAl2EctF8U8TSgoqJt8TvoEJmk5lsdDqXZxxnUyr4Xfn8Bvjq0dVGC3PR7JhMV9LaeHMB84vs8LcGMQKKf5FD3Tu73cOyMkuFLRJktzfV9ITMWqrv/yl2fVnxqceHDcM= 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=S9qci7mY; 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="S9qci7mY" 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 634AF1476; Sat, 25 Jul 2026 04:36:58 -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 100693F86F; Sat, 25 Jul 2026 04:36:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1784979422; bh=08jMdtod7Ir4RxqBmMzY3RvBdF+D2iKjLfEjJc2o1Go=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S9qci7mYedvhvRtSBerQHnwoFSG5TF+D7QRExnCf53c/OdCSQcqLCv+D1DF2/NPDP nzttSkLwajCEaRV1JS7rgNKL8WPs/f1zX+vMF57Mm82Jr0MZ7jhsUghPyBqJ7tZrPw yjSwTola15PJnl+LZQTkV3QSH1toxQnitdOaGHqk= 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 v9 03/13] coresight: etm4x: fix leaked trace id Date: Sat, 25 Jul 2026 12:36:35 +0100 Message-ID: <20260725113645.57519-4-yeoreum.yun@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260725113645.57519-1-yeoreum.yun@arm.com> References: <20260725113645.57519-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 1884960cfe6f..8363c55b3952 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -920,8 +920,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}