From: Greg Kroah-Hartman Date: Mon, 17 Oct 2022 09:33:29 +0000 (+0200) Subject: 5.10-stable patches X-Git-Tag: v5.4.219~35 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a482b6cf31000de13250a26bed5464b22d23fb64;p=thirdparty%2Fkernel%2Fstable-queue.git 5.10-stable patches added patches: arm64-topology-fix-possible-overflow-in-amu_fie_setup.patch --- diff --git a/queue-5.10/arm64-topology-fix-possible-overflow-in-amu_fie_setup.patch b/queue-5.10/arm64-topology-fix-possible-overflow-in-amu_fie_setup.patch new file mode 100644 index 00000000000..4b6943713c0 --- /dev/null +++ b/queue-5.10/arm64-topology-fix-possible-overflow-in-amu_fie_setup.patch @@ -0,0 +1,37 @@ +From d4955c0ad77dbc684fc716387070ac24801b8bca Mon Sep 17 00:00:00 2001 +From: Sergey Shtylyov +Date: Fri, 16 Sep 2022 23:17:07 +0300 +Subject: arm64: topology: fix possible overflow in amu_fie_setup() + +From: Sergey Shtylyov + +commit d4955c0ad77dbc684fc716387070ac24801b8bca upstream. + +cpufreq_get_hw_max_freq() returns max frequency in kHz as *unsigned int*, +while freq_inv_set_max_ratio() gets passed this frequency in Hz as 'u64'. +Multiplying max frequency by 1000 can potentially result in overflow -- +multiplying by 1000ULL instead should avoid that... + +Found by Linux Verification Center (linuxtesting.org) with the SVACE static +analysis tool. + +Fixes: cd0ed03a8903 ("arm64: use activity monitors for frequency invariance") +Signed-off-by: Sergey Shtylyov +Link: https://lore.kernel.org/r/01493d64-2bce-d968-86dc-11a122a9c07d@omp.ru +Signed-off-by: Will Deacon +Signed-off-by: Greg Kroah-Hartman +--- + arch/arm64/kernel/topology.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/arm64/kernel/topology.c ++++ b/arch/arm64/kernel/topology.c +@@ -158,7 +158,7 @@ static int validate_cpu_freq_invariance_ + } + + /* Convert maximum frequency from KHz to Hz and validate */ +- max_freq_hz = cpufreq_get_hw_max_freq(cpu) * 1000; ++ max_freq_hz = cpufreq_get_hw_max_freq(cpu) * 1000ULL; + if (unlikely(!max_freq_hz)) { + pr_debug("CPU%d: invalid maximum frequency.\n", cpu); + return -EINVAL; diff --git a/queue-5.10/series b/queue-5.10/series index 1503315c357..b1cb08e7546 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -456,3 +456,4 @@ usb-idmouse-fix-an-uninit-value-in-idmouse_open.patch fsi-master-ast-cf-fix-missing-of_node_put-in-fsi_mas.patch clk-bcm2835-make-peripheral-pllc-critical.patch perf-intel-pt-fix-segfault-in-intel_pt_print_info-with-uclibc.patch +arm64-topology-fix-possible-overflow-in-amu_fie_setup.patch