summaryrefslogtreecommitdiff
path: root/drivers/perf
diff options
context:
space:
mode:
authorRobin Murphy <robin.murphy@arm.com>2023-12-11 19:27:28 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-10-04 16:30:04 +0200
commit18b5ee7bf70048d85cc1b424e862cb762421b2c5 (patch)
treeadde699f99a457fdabd3cae543341e2a04c607de /drivers/perf
parente43caacf61101a962b9ba35c9d2b5c2628ec5eca (diff)
downloadlinux-18b5ee7bf70048d85cc1b424e862cb762421b2c5.tar.gz
linux-18b5ee7bf70048d85cc1b424e862cb762421b2c5.tar.bz2
linux-18b5ee7bf70048d85cc1b424e862cb762421b2c5.zip
perf/arm-cmn: Fail DTC counter allocation correctly
commit 1892fe103c3a20fced306c8dafa74f7f6d4ea0a3 upstream. Calling arm_cmn_event_clear() before all DTC indices are allocated is wrong, and can lead to arm_cmn_event_add() erroneously clearing live counters from full DTCs where allocation fails. Since the DTC counters are only updated by arm_cmn_init_counter() after all DTC and DTM allocations succeed, nothing actually needs cleaning up in this case anyway, and it should just return directly as it did before. Fixes: 7633ec2c262f ("perf/arm-cmn: Rework DTC counters (again)") Signed-off-by: Robin Murphy <robin.murphy@arm.com> Reviewed-by: Ilkka Koskinen <ilkka@os.amperecomputing.com> Acked-by: Will Deacon <will@kernel.org> Link: https://lore.kernel.org/r/ed589c0d8e4130dc68b8ad1625226d28bdc185d4.1702322847.git.robin.murphy@arm.com Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/perf')
-rw-r--r--drivers/perf/arm-cmn.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
index 7d5e8cb96e9b..0b3ce7713645 100644
--- a/drivers/perf/arm-cmn.c
+++ b/drivers/perf/arm-cmn.c
@@ -1794,7 +1794,7 @@ static int arm_cmn_event_add(struct perf_event *event, int flags)
idx = 0;
while (cmn->dtc[j].counters[idx])
if (++idx == CMN_DT_NUM_COUNTERS)
- goto free_dtms;
+ return -ENOSPC;
}
hw->dtc_idx[j] = idx;
}