From: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
To: Mike Turquette <mturquette@linaro.org>
Cc: "Stephen Boyd" <sboyd@codeaurora.org>,
"Tomeu Vizoso" <tomeu.vizoso@collabora.com>,
"Emilio López" <emilio@elopez.com.ar>,
"Peter De Schrijver" <pdeschrijver@nvidia.com>,
"Robert Jarzmik" <robert.jarzmik@free.fr>,
"Giuseppe Cavallaro" <peppe.cavallaro@st.com>,
linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org,
"Javier Martinez Canillas" <javier.martinez@collabora.co.uk>
Subject: [PATCH v2 1/3] clk: Don't dereference parent clock if is NULL
Date: Thu, 12 Feb 2015 14:58:28 +0100 [thread overview]
Message-ID: <1423749510-14525-2-git-send-email-javier.martinez@collabora.co.uk> (raw)
In-Reply-To: <1423749510-14525-1-git-send-email-javier.martinez@collabora.co.uk>
The clock passed as an argument to clk_mux_determine_rate_flags()
has the CLK_SET_RATE_PARENT flag set but it has no parent, then a
NULL pointer will tried to be dereferenced.
This shouldn't happen since setting that flag for a clock with no
parent is a bug but the core should be robust to handle that case.
Fixes: 035a61c314eb3 ("clk: Make clk API return per-user struct clk instances")
Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
---
Changes since v2:
- Pass NULL struct clk_hw argument to __clk_determine_rate() if parent is NULL.
suggested by Stephen Boyd.
---
drivers/clk/clk.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 7f53166af5e6..5941af7b4665 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -800,8 +800,8 @@ clk_mux_determine_rate_flags(struct clk_hw *hw, unsigned long rate,
if (core->flags & CLK_SET_RATE_NO_REPARENT) {
parent = core->parent;
if (core->flags & CLK_SET_RATE_PARENT)
- best = __clk_determine_rate(parent->hw, rate,
- min_rate, max_rate);
+ best = __clk_determine_rate(parent ? parent->hw : NULL,
+ rate, min_rate, max_rate);
else if (parent)
best = clk_core_get_rate_nolock(parent);
else
--
2.1.3
next prev parent reply other threads:[~2015-02-12 13:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-12 13:58 [PATCH v2 0/3] clk: Some fixes for the per-user clk API changes Javier Martinez Canillas
2015-02-12 13:58 ` Javier Martinez Canillas [this message]
2015-02-12 19:00 ` [PATCH v2 1/3] clk: Don't dereference parent clock if is NULL Stephen Boyd
2015-02-12 13:58 ` [PATCH v2 2/3] clk: Add __clk_hw_set_clk helper function Javier Martinez Canillas
2015-02-12 19:55 ` Stephen Boyd
2015-02-13 7:28 ` Javier Martinez Canillas
2015-02-12 13:58 ` [PATCH v2 3/3] clk: Replace explicit clk assignment with __clk_hw_set_clk Javier Martinez Canillas
2015-02-12 16:12 ` Robert Jarzmik
2015-02-12 19:55 ` Stephen Boyd
2015-02-13 7:23 ` Javier Martinez Canillas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1423749510-14525-2-git-send-email-javier.martinez@collabora.co.uk \
--to=javier.martinez@collabora.co.uk \
--cc=emilio@elopez.com.ar \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=mturquette@linaro.org \
--cc=pdeschrijver@nvidia.com \
--cc=peppe.cavallaro@st.com \
--cc=robert.jarzmik@free.fr \
--cc=sboyd@codeaurora.org \
--cc=tomeu.vizoso@collabora.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®