Thread (2 messages) 2 messages, 2 authors, 2019-03-28
STALE2620d

[PATCH] cpufreq: scpi: fix use after free

From: Vincent Stehlé <hidden>
Date: 2019-03-27 22:30:28
Also in: linux-arm-kernel, lkml
Subsystem: cpu frequency scaling framework, system control & power/management interface (scpi/scmi) message protocol drivers, the rest · Maintainers: "Rafael J. Wysocki", Viresh Kumar, Sudeep Holla, Linus Torvalds

Free the priv structure only after we are done using it.

Fixes: 1690d8bb91e370ab ("cpufreq: scpi/scmi: Fix freeing of dynamic OPPs")
Signed-off-by: Vincent Stehlé <redacted>
Cc: Sudeep Holla <redacted>
Cc: "Rafael J. Wysocki" <redacted>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/cpufreq/scpi-cpufreq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/cpufreq/scpi-cpufreq.c b/drivers/cpufreq/scpi-cpufreq.c
index 3f49427766b88..2b51e0718c9f6 100644
--- a/drivers/cpufreq/scpi-cpufreq.c
+++ b/drivers/cpufreq/scpi-cpufreq.c
@@ -189,8 +189,8 @@ static int scpi_cpufreq_exit(struct cpufreq_policy *policy)
 
 	clk_put(priv->clk);
 	dev_pm_opp_free_cpufreq_table(priv->cpu_dev, &policy->freq_table);
-	kfree(priv);
 	dev_pm_opp_remove_all_dynamic(priv->cpu_dev);
+	kfree(priv);
 
 	return 0;
 }
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help