]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
drivers/perf: hisi_pcie: Check the type first in pmu::event_init()
authorYicong Yang <yangyicong@hisilicon.com>
Tue, 24 Oct 2023 09:29:53 +0000 (17:29 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 20 Nov 2023 10:57:03 +0000 (11:57 +0100)
commit3d92672e71d9c56102eb58c324ffcc66e1cb31eb
treedfd71db8cbc9e32665f97ded8f2791a0d3b69140
parentb4a182cd0336a9debbce5b05a562cf4a81507da0
drivers/perf: hisi_pcie: Check the type first in pmu::event_init()

[ Upstream commit 6d7d51e88e21c0af1ca96a3617afef334bfeffcf ]

Check whether the event type matches the PMU type firstly in
pmu::event_init() before touching the event. Otherwise we'll
change the events of others and lead to incorrect results.
Since in perf_init_event() we may call every pmu's event_init()
in a certain case, we should not modify the event if it's not
ours.

Fixes: 8404b0fbc7fb ("drivers/perf: hisi: Add driver for HiSilicon PCIe PMU")
Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
Link: https://lore.kernel.org/r/20231024092954.42297-2-yangyicong@huawei.com
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/perf/hisilicon/hisi_pcie_pmu.c