]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
coresight: Only register perf symlink for sinks with alloc_buffer
authorYuanfang Zhang <quic_yuanfang@quicinc.com>
Mon, 30 Jun 2025 10:26:19 +0000 (18:26 +0800)
committerSuzuki K Poulose <suzuki.poulose@arm.com>
Tue, 2 Sep 2025 08:12:58 +0000 (09:12 +0100)
Ensure that etm_perf_add_symlink_sink() is only called for devices
that implement the alloc_buffer operation. This prevents invalid
symlink creation for dummy sinks that do not implement alloc_buffer.

Without this check, perf may attempt to use a dummy sink that lacks
alloc_buffer operationsu to initialise perf's ring buffer, leading
to runtime failures.

Fixes: 9d3ba0b6c0569 ("Coresight: Add coresight dummy driver")
Signed-off-by: Yuanfang Zhang <quic_yuanfang@quicinc.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20250630-etm_perf_sink-v1-1-e4a7211f9ad7@quicinc.com
drivers/hwtracing/coresight/coresight-core.c

index c2db94f2ab2378d7084e7fc2b4f23a66e8b1c1f4..1accd7cbd54bf0c41ba209dccfd510d9710a21f7 100644 (file)
@@ -1375,8 +1375,9 @@ struct coresight_device *coresight_register(struct coresight_desc *desc)
                goto out_unlock;
        }
 
-       if (csdev->type == CORESIGHT_DEV_TYPE_SINK ||
-           csdev->type == CORESIGHT_DEV_TYPE_LINKSINK) {
+       if ((csdev->type == CORESIGHT_DEV_TYPE_SINK ||
+            csdev->type == CORESIGHT_DEV_TYPE_LINKSINK) &&
+           sink_ops(csdev)->alloc_buffer) {
                ret = etm_perf_add_symlink_sink(csdev);
 
                if (ret) {