diff options
author | Tuan Phan <tuanphan@os.amperecomputing.com> | 2021-06-17 09:08:49 -0700 |
---|---|---|
committer | Will Deacon <will@kernel.org> | 2021-06-17 19:45:02 +0100 |
commit | 4e16f283edc289820e9b2d6f617ed8e514ee8396 (patch) | |
tree | 830b869e222f99ad9e5a311f3ce7cb5ce7e46ae0 /drivers/perf | |
parent | 64432f09068a0fa76f20918a3c22ee3484a3762d (diff) | |
download | linux-4e16f283edc289820e9b2d6f617ed8e514ee8396.tar.bz2 |
perf/arm-cmn: Fix invalid pointer when access dtc object sharing the same IRQ number
When multiple dtcs share the same IRQ number, the irq_friend which
used to refer to dtc object gets calculated incorrect which leads
to invalid pointer.
Fixes: 0ba64770a2f2 ("perf: Add Arm CMN-600 PMU driver")
Signed-off-by: Tuan Phan <tuanphan@os.amperecomputing.com>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Link: https://lore.kernel.org/r/1623946129-3290-1-git-send-email-tuanphan@os.amperecomputing.com
Signed-off-by: Will Deacon <will@kernel.org>
Diffstat (limited to 'drivers/perf')
-rw-r--r-- | drivers/perf/arm-cmn.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c index 4f46f654279d..bc3cba5f8c5d 100644 --- a/drivers/perf/arm-cmn.c +++ b/drivers/perf/arm-cmn.c @@ -1212,7 +1212,7 @@ static int arm_cmn_init_irqs(struct arm_cmn *cmn) irq = cmn->dtc[i].irq; for (j = i; j--; ) { if (cmn->dtc[j].irq == irq) { - cmn->dtc[j].irq_friend = j - i; + cmn->dtc[j].irq_friend = i - j; goto next; } } |