Commit c7662fc59ca38517e0ec04ceaa123ed8209ab6bf
Committed by
Michael Turquette
1 parent
176a107b86
Exists in
ti-lsk-linux-4.1.y
and in
10 other branches
clk: fix possible null pointer dereference
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> Reviewed-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Michael Turquette <mturquette@linaro.org>
Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff
drivers/clk/clk.c
... | ... | @@ -1366,7 +1366,7 @@ |
1366 | 1366 | new_rate = clk->ops->determine_rate(clk->hw, rate, |
1367 | 1367 | &best_parent_rate, |
1368 | 1368 | &parent_hw); |
1369 | - parent = parent_hw->clk; | |
1369 | + parent = parent_hw ? parent_hw->clk : NULL; | |
1370 | 1370 | } else if (clk->ops->round_rate) { |
1371 | 1371 | new_rate = clk->ops->round_rate(clk->hw, rate, |
1372 | 1372 | &best_parent_rate); |