Re: [PATCH v4] cpupower: fix use-after-free and stale limits in frequency-set

From: Shuah Khan

Date: Mon Nov 23 2026 - 16:39:59 EST


On 11/20/26 15:17, Lukas Beckmann wrote:
do_new_policy() directly fills the unset fields of new_pol from the
current CPU's policy. This is problematic because do_new_policy() is
called with the same new_pol for multiple CPUs by do_one_cpu() in the
slow path. This results in stale values in new_pol being applied
(starting from the second CPU that should be changed), and even a
use-after-free (for the governor string).

Fix this by building the target policy from new_pol and the current
policy in do_new_policy() instead of filling the missing values into
new_pol.

Fixes: 7fe2f6399a84 ("cpupowerutils - cpufrequtils extended with quite some features")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Lukas Beckmann <lbckmnn@xxxxxxxxxxx>
---
Applied to my cpupower branch for next PR to PM maintainer.

https://web.git.kernel.org/pub/scm/linux/kernel/git/shuah/linux.git/log/?h=cpupower

thanks,
-- Shuah