diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2023-02-08 10:26:54 +0100 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2023-02-09 20:26:42 +0100 |
commit | 5d8f384a9b4fc50f6a18405f1c08e5a87a77b5b3 (patch) | |
tree | 6420ebc7b90914dde028b85a8ba737e753ee5f30 /drivers/cpufreq/davinci-cpufreq.c | |
parent | cpufreq: amd-pstate: avoid uninitialized variable use (diff) | |
download | linux-5d8f384a9b4fc50f6a18405f1c08e5a87a77b5b3.tar.xz linux-5d8f384a9b4fc50f6a18405f1c08e5a87a77b5b3.zip |
cpufreq: davinci: Fix clk use after free
The remove function first frees the clks and only then calls
cpufreq_unregister_driver(). If one of the cpufreq callbacks is called
just before cpufreq_unregister_driver() is run, the freed clks might be
used.
Fixes: 6601b8030de3 ("davinci: add generic CPUFreq driver for DaVinci")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpufreq/davinci-cpufreq.c')
-rw-r--r-- | drivers/cpufreq/davinci-cpufreq.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/cpufreq/davinci-cpufreq.c b/drivers/cpufreq/davinci-cpufreq.c index 2d23015e2abd..ebb3a8102681 100644 --- a/drivers/cpufreq/davinci-cpufreq.c +++ b/drivers/cpufreq/davinci-cpufreq.c @@ -133,13 +133,13 @@ static int __init davinci_cpufreq_probe(struct platform_device *pdev) static int __exit davinci_cpufreq_remove(struct platform_device *pdev) { + cpufreq_unregister_driver(&davinci_driver); + clk_put(cpufreq.armclk); if (cpufreq.asyncclk) clk_put(cpufreq.asyncclk); - cpufreq_unregister_driver(&davinci_driver); - return 0; } |