Skip to content

Commit 5d8f384

Browse files
Uwe Kleine-Königrafaeljw
authored andcommitted
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: 6601b80 ("davinci: add generic CPUFreq driver for DaVinci") Signed-off-by: Uwe Kleine-König <[email protected]> Acked-by: Viresh Kumar <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 7cca9a9 commit 5d8f384

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/cpufreq/davinci-cpufreq.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,13 @@ static int __init davinci_cpufreq_probe(struct platform_device *pdev)
133133

134134
static int __exit davinci_cpufreq_remove(struct platform_device *pdev)
135135
{
136+
cpufreq_unregister_driver(&davinci_driver);
137+
136138
clk_put(cpufreq.armclk);
137139

138140
if (cpufreq.asyncclk)
139141
clk_put(cpufreq.asyncclk);
140142

141-
cpufreq_unregister_driver(&davinci_driver);
142-
143143
return 0;
144144
}
145145

0 commit comments

Comments
 (0)