Skip to content

Commit

Permalink
perf/arm-cmn: Fix invalid pointer when access dtc object sharing the …
Browse files Browse the repository at this point in the history
…same IRQ number

[ Upstream commit 4e16f28 ]

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: 0ba6477 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Tuan Phan authored and gregkh committed Jul 14, 2021
1 parent 0d3fab3 commit 71d201c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/perf/arm-cmn.c
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 71d201c

Please sign in to comment.