summaryrefslogtreecommitdiff
path: root/tools/lib/python
diff options
context:
space:
mode:
authorAnfernee Cao <anferneemelokc5@gmail.com>2026-10-21 21:58:39 +0800
committerUlf Hansson <ulfh@kernel.org>2026-11-23 15:01:36 +0100
commit831f98ccaebdb71649519eea75094f16a633fc89 (patch)
treea2a65a831b17099bd044a6fcc67eaed2621769c4 /tools/lib/python
parent6cb66a7c4897f5011b954c7ed15ffa43c9a49bf9 (diff)
pmdomain: core: clear states after freeing them
genpd_free_data() frees the genpd power states through the ->free_states() callback, but leaves genpd->states and genpd->state_count pointing at the freed memory. Providers that allocate the states themselves hand them over to genpd by setting ->free_states(). When they fail after genpd has taken over, they still run their own free helper, as psci_pd_init() and the RISC-V SBI idle driver do: remove_pd: pm_genpd_remove(pd); /* frees states via ->free_states() */ ... dt_idle_pd_free(pd); /* frees them again */ The second call dereferences the freed states array and frees it again, causing a use-after-free and a double free. Clear genpd->states and genpd->state_count once the states have been freed, so that a later free helper becomes a no-op. This issue was found by manual code inspection. Fixes: 9d976d6721df ("cpuidle: Factor-out power domain related code from PSCI domain driver") Cc: stable@vger.kernel.org # v5.18+ Signed-off-by: Anfernee Cao <anferneemelokc5@gmail.com> Signed-off-by: Ulf Hansson <ulfh@kernel.org>
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions