From: Sean Anderson <sean.anderson@linux.dev>
To: Suzuki K Poulose <suzuki.poulose@arm.com>,
coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org
Cc: Leo Yan <leo.yan@arm.com>, Yeoreum Yun <yeoreum.yun@arm.com>,
Linu Cherian <lcherian@marvell.com>,
Mike Leach <mike.leach@linaro.org>,
linux-kernel@vger.kernel.org,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
James Clark <james.clark@linaro.org>,
Sean Anderson <sean.anderson@linux.dev>
Subject: [PATCH v5 1/3] coresight: Fix fwnode leak in coresight_register error path
Date: Thu, 25 Sep 2025 11:03:40 -0400 [thread overview]
Message-ID: <20250925150342.1845615-2-sean.anderson@linux.dev> (raw)
In-Reply-To: <20250925150342.1845615-1-sean.anderson@linux.dev>
If registering the CPU map fails, we need to put the fwnode. free_percpu
works when called with a NULL pointer, so just use
coresight_device_release.
Fixes: 5ad628a76176 ("coresight: Use per-sink trace ID maps for Perf sessions")
Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
---
(no changes since v4)
Changes in v4:
- New
drivers/hwtracing/coresight/coresight-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtracing/coresight/coresight-core.c
index fa758cc21827..022c8384b98d 100644
--- a/drivers/hwtracing/coresight/coresight-core.c
+++ b/drivers/hwtracing/coresight/coresight-core.c
@@ -1352,7 +1352,7 @@ struct coresight_device *coresight_register(struct coresight_desc *desc)
raw_spin_lock_init(&csdev->perf_sink_id_map.lock);
csdev->perf_sink_id_map.cpu_map = alloc_percpu(atomic_t);
if (!csdev->perf_sink_id_map.cpu_map) {
- kfree(csdev);
+ coresight_device_release(&csdev->dev);
ret = -ENOMEM;
goto err_out;
}
--
2.35.1.1320.gc452695387.dirty
next prev parent reply other threads:[~2025-09-25 15:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-25 15:03 [PATCH v5 0/3] coresight: Fix possible deadlock in coresight_panic_cb Sean Anderson
2025-09-25 15:03 ` Sean Anderson [this message]
2025-09-26 10:16 ` [PATCH v5 1/3] coresight: Fix fwnode leak in coresight_register error path Mike Leach
2025-09-25 15:03 ` [PATCH v5 2/3] coresight: Reorder coresight_device_release to match coresight_register Sean Anderson
2025-09-26 10:21 ` Mike Leach
2025-09-25 15:03 ` [PATCH v5 3/3] coresight: Fix possible deadlock in coresight_panic_cb Sean Anderson
2025-09-25 16:22 ` Leo Yan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250925150342.1845615-2-sean.anderson@linux.dev \
--to=sean.anderson@linux.dev \
--cc=alexander.shishkin@linux.intel.com \
--cc=coresight@lists.linaro.org \
--cc=james.clark@linaro.org \
--cc=lcherian@marvell.com \
--cc=leo.yan@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mike.leach@linaro.org \
--cc=suzuki.poulose@arm.com \
--cc=yeoreum.yun@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox