* [PATCH] clk: fix possible null pointer dereference
@ 2015-01-05 16:04 Stanimir Varbanov
2015-01-05 19:34 ` Stephen Boyd
0 siblings, 1 reply; 3+ messages in thread
From: Stanimir Varbanov @ 2015-01-05 16:04 UTC (permalink / raw)
To: Mike Turquette, Stephen Boyd
Cc: linux-kernel, Tomeu Vizoso, Stanimir Varbanov
The commit 646cafc6 (clk: Change clk_ops->determine_rate to
return a clk_hw as the best parent) opens a possibility for
null pointer dereference, fix this.
Signed-off-by: Stanimir Varbanov <svarbanov@mm-sol.com>
---
drivers/clk/clk.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index f4963b7..d48ac71 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -1366,7 +1366,7 @@ static struct clk *clk_calc_new_rates(struct clk *clk, unsigned long rate)
new_rate = clk->ops->determine_rate(clk->hw, rate,
&best_parent_rate,
&parent_hw);
- parent = parent_hw->clk;
+ parent = parent_hw ? parent_hw->clk : NULL;
} else if (clk->ops->round_rate) {
new_rate = clk->ops->round_rate(clk->hw, rate,
&best_parent_rate);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] clk: fix possible null pointer dereference
2015-01-05 16:04 [PATCH] clk: fix possible null pointer dereference Stanimir Varbanov
@ 2015-01-05 19:34 ` Stephen Boyd
2015-01-17 21:45 ` Mike Turquette
0 siblings, 1 reply; 3+ messages in thread
From: Stephen Boyd @ 2015-01-05 19:34 UTC (permalink / raw)
To: Stanimir Varbanov, Mike Turquette; +Cc: linux-kernel, Tomeu Vizoso
On 01/05/2015 08:04 AM, Stanimir Varbanov wrote:
> The commit 646cafc6 (clk: Change clk_ops->determine_rate to
> return a clk_hw as the best parent) opens a possibility for
> null pointer dereference, fix this.
>
> Signed-off-by: Stanimir Varbanov <svarbanov@mm-sol.com>
Yep. Hopefully we can clean this all up soon.
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
> ---
> drivers/clk/clk.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index f4963b7..d48ac71 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -1366,7 +1366,7 @@ static struct clk *clk_calc_new_rates(struct clk *clk, unsigned long rate)
> new_rate = clk->ops->determine_rate(clk->hw, rate,
> &best_parent_rate,
> &parent_hw);
> - parent = parent_hw->clk;
> + parent = parent_hw ? parent_hw->clk : NULL;
> } else if (clk->ops->round_rate) {
> new_rate = clk->ops->round_rate(clk->hw, rate,
> &best_parent_rate);
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] clk: fix possible null pointer dereference
2015-01-05 19:34 ` Stephen Boyd
@ 2015-01-17 21:45 ` Mike Turquette
0 siblings, 0 replies; 3+ messages in thread
From: Mike Turquette @ 2015-01-17 21:45 UTC (permalink / raw)
To: Stephen Boyd, Stanimir Varbanov; +Cc: linux-kernel, Tomeu Vizoso
Quoting Stephen Boyd (2015-01-05 11:34:32)
> On 01/05/2015 08:04 AM, Stanimir Varbanov wrote:
> > The commit 646cafc6 (clk: Change clk_ops->determine_rate to
> > return a clk_hw as the best parent) opens a possibility for
> > null pointer dereference, fix this.
> >
> > Signed-off-by: Stanimir Varbanov <svarbanov@mm-sol.com>
>
> Yep. Hopefully we can clean this all up soon.
>
> Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Applied to clk-fixes.
Regards,
Mike
>
> > ---
> > drivers/clk/clk.c | 2 +-
> > 1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> > index f4963b7..d48ac71 100644
> > --- a/drivers/clk/clk.c
> > +++ b/drivers/clk/clk.c
> > @@ -1366,7 +1366,7 @@ static struct clk *clk_calc_new_rates(struct clk *clk, unsigned long rate)
> > new_rate = clk->ops->determine_rate(clk->hw, rate,
> > &best_parent_rate,
> > &parent_hw);
> > - parent = parent_hw->clk;
> > + parent = parent_hw ? parent_hw->clk : NULL;
> > } else if (clk->ops->round_rate) {
> > new_rate = clk->ops->round_rate(clk->hw, rate,
> > &best_parent_rate);
>
>
> --
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
> a Linux Foundation Collaborative Project
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-01-17 21:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-05 16:04 [PATCH] clk: fix possible null pointer dereference Stanimir Varbanov
2015-01-05 19:34 ` Stephen Boyd
2015-01-17 21:45 ` Mike Turquette
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox