* [patch] cpufreq: s3c2416: double free on driver init error path
@ 2017-02-07 13:19 Dan Carpenter
2017-02-07 20:29 ` Krzysztof Kozlowski
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Dan Carpenter @ 2017-02-07 13:19 UTC (permalink / raw)
To: Kukjin Kim, Heiko Stübner
Cc: Krzysztof Kozlowski, Javier Martinez Canillas, Rafael J. Wysocki,
Viresh Kumar, linux-samsung-soc, linux-pm, kernel-janitors
The "goto err_armclk;" error path already does a clk_put(s3c_freq->hclk);
so this is a double free.
Fixes: 34ee55075265 ("[CPUFREQ] Add S3C2416/S3C2450 cpufreq driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/cpufreq/s3c2416-cpufreq.c b/drivers/cpufreq/s3c2416-cpufreq.c
index d6d425773fa4..5b2db3c6568f 100644
--- a/drivers/cpufreq/s3c2416-cpufreq.c
+++ b/drivers/cpufreq/s3c2416-cpufreq.c
@@ -400,7 +400,6 @@ static int s3c2416_cpufreq_driver_init(struct cpufreq_policy *policy)
rate = clk_get_rate(s3c_freq->hclk);
if (rate < 133 * 1000 * 1000) {
pr_err("cpufreq: HCLK not at 133MHz\n");
- clk_put(s3c_freq->hclk);
ret = -EINVAL;
goto err_armclk;
}
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [patch] cpufreq: s3c2416: double free on driver init error path
2017-02-07 13:19 [patch] cpufreq: s3c2416: double free on driver init error path Dan Carpenter
@ 2017-02-07 20:29 ` Krzysztof Kozlowski
2017-02-08 3:24 ` Viresh Kumar
2017-02-09 12:44 ` Heiko Stübner
2 siblings, 0 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2017-02-07 20:29 UTC (permalink / raw)
To: Dan Carpenter
Cc: Kukjin Kim, Heiko Stübner, Javier Martinez Canillas,
Rafael J. Wysocki, Viresh Kumar, linux-samsung-soc, linux-pm,
kernel-janitors
On Tue, Feb 07, 2017 at 04:19:06PM +0300, Dan Carpenter wrote:
> The "goto err_armclk;" error path already does a clk_put(s3c_freq->hclk);
> so this is a double free.
>
> Fixes: 34ee55075265 ("[CPUFREQ] Add S3C2416/S3C2450 cpufreq driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch] cpufreq: s3c2416: double free on driver init error path
2017-02-07 13:19 [patch] cpufreq: s3c2416: double free on driver init error path Dan Carpenter
2017-02-07 20:29 ` Krzysztof Kozlowski
@ 2017-02-08 3:24 ` Viresh Kumar
2017-02-09 12:44 ` Heiko Stübner
2 siblings, 0 replies; 4+ messages in thread
From: Viresh Kumar @ 2017-02-08 3:24 UTC (permalink / raw)
To: Dan Carpenter
Cc: Kukjin Kim, Heiko Stübner, Krzysztof Kozlowski,
Javier Martinez Canillas, Rafael J. Wysocki, linux-samsung-soc,
linux-pm, kernel-janitors
On 07-02-17, 16:19, Dan Carpenter wrote:
> The "goto err_armclk;" error path already does a clk_put(s3c_freq->hclk);
> so this is a double free.
>
> Fixes: 34ee55075265 ("[CPUFREQ] Add S3C2416/S3C2450 cpufreq driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/cpufreq/s3c2416-cpufreq.c b/drivers/cpufreq/s3c2416-cpufreq.c
> index d6d425773fa4..5b2db3c6568f 100644
> --- a/drivers/cpufreq/s3c2416-cpufreq.c
> +++ b/drivers/cpufreq/s3c2416-cpufreq.c
> @@ -400,7 +400,6 @@ static int s3c2416_cpufreq_driver_init(struct cpufreq_policy *policy)
> rate = clk_get_rate(s3c_freq->hclk);
> if (rate < 133 * 1000 * 1000) {
> pr_err("cpufreq: HCLK not at 133MHz\n");
> - clk_put(s3c_freq->hclk);
> ret = -EINVAL;
> goto err_armclk;
> }
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
--
viresh
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch] cpufreq: s3c2416: double free on driver init error path
2017-02-07 13:19 [patch] cpufreq: s3c2416: double free on driver init error path Dan Carpenter
2017-02-07 20:29 ` Krzysztof Kozlowski
2017-02-08 3:24 ` Viresh Kumar
@ 2017-02-09 12:44 ` Heiko Stübner
2 siblings, 0 replies; 4+ messages in thread
From: Heiko Stübner @ 2017-02-09 12:44 UTC (permalink / raw)
To: Dan Carpenter
Cc: Kukjin Kim, Krzysztof Kozlowski, Javier Martinez Canillas,
Rafael J. Wysocki, Viresh Kumar, linux-samsung-soc, linux-pm,
kernel-janitors
Hi Dan,
Am Dienstag, 7. Februar 2017, 16:19:06 CET schrieb Dan Carpenter:
> The "goto err_armclk;" error path already does a clk_put(s3c_freq->hclk);
> so this is a double free.
>
> Fixes: 34ee55075265 ("[CPUFREQ] Add S3C2416/S3C2450 cpufreq driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Interesting, you found a mistake I made 5 years ago.
It always amazes me how much time I already spent in kernel-land :-) .
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Thanks for finding and fixing this
Heiko
> diff --git a/drivers/cpufreq/s3c2416-cpufreq.c
> b/drivers/cpufreq/s3c2416-cpufreq.c index d6d425773fa4..5b2db3c6568f 100644
> --- a/drivers/cpufreq/s3c2416-cpufreq.c
> +++ b/drivers/cpufreq/s3c2416-cpufreq.c
> @@ -400,7 +400,6 @@ static int s3c2416_cpufreq_driver_init(struct
> cpufreq_policy *policy) rate = clk_get_rate(s3c_freq->hclk);
> if (rate < 133 * 1000 * 1000) {
> pr_err("cpufreq: HCLK not at 133MHz\n");
> - clk_put(s3c_freq->hclk);
> ret = -EINVAL;
> goto err_armclk;
> }
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-02-09 14:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-07 13:19 [patch] cpufreq: s3c2416: double free on driver init error path Dan Carpenter
2017-02-07 20:29 ` Krzysztof Kozlowski
2017-02-08 3:24 ` Viresh Kumar
2017-02-09 12:44 ` Heiko Stübner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).