summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2024-11-15 20:44:32 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2024-11-15 20:44:32 +0100
commite8bdb3c8be08c9a3edc0a373c0aa8729355a0705 (patch)
treef9420586c9b636afe2fb7258a683584e07b50c6e
parentMerge tag 'drm-fixes-2024-11-16' of https://gitlab.freedesktop.org/drm/kernel (diff)
parentdrivers: perf: Fix wrong put_cpu() placement (diff)
downloadlinux-e8bdb3c8be08c9a3edc0a373c0aa8729355a0705.tar.xz
linux-e8bdb3c8be08c9a3edc0a373c0aa8729355a0705.zip
Merge tag 'riscv-for-linus-6.12-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux
Pull RISC-V fix from Palmer Dabbelt: - A fix for the CPU perf driver that avoids leaking CPU ID references on systems without snapshot support. * tag 'riscv-for-linus-6.12-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux: drivers: perf: Fix wrong put_cpu() placement
-rw-r--r--drivers/perf/riscv_pmu_sbi.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/perf/riscv_pmu_sbi.c b/drivers/perf/riscv_pmu_sbi.c
index 391ca1422cae..1aa303f76cc7 100644
--- a/drivers/perf/riscv_pmu_sbi.c
+++ b/drivers/perf/riscv_pmu_sbi.c
@@ -1393,8 +1393,9 @@ static int pmu_sbi_device_probe(struct platform_device *pdev)
goto out_unregister;
cpu = get_cpu();
-
ret = pmu_sbi_snapshot_setup(pmu, cpu);
+ put_cpu();
+
if (ret) {
/* Snapshot is an optional feature. Continue if not available */
pmu_sbi_snapshot_free(pmu);
@@ -1408,7 +1409,6 @@ static int pmu_sbi_device_probe(struct platform_device *pdev)
*/
static_branch_enable(&sbi_pmu_snapshot_available);
}
- put_cpu();
}
register_sysctl("kernel", sbi_pmu_sysctl_table);