From: Stephen Boyd <sboyd@codeaurora.org>
To: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Cc: Mike Turquette <mturquette@linaro.org>,
Javier Martinez Canillas <javier.martinez@collabora.co.uk>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 3/8] clk: Don't try to use a struct clk* after it could have been freed
Date: Thu, 9 Oct 2014 13:27:33 -0700 [thread overview]
Message-ID: <20141009202733.GD5493@codeaurora.org> (raw)
In-Reply-To: <1412866903-6970-4-git-send-email-tomeu.vizoso@collabora.com>
On 10/09, Tomeu Vizoso wrote:
> As __clk_release could call kfree on clk and then we wouldn't have a safe way
> of getting the module that owns the clock.
>
> Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
It would be good to mark this as a "Fixes:".
> ---
> drivers/clk/clk.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index d0712b7..40aa7ad 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -2268,14 +2268,16 @@ int __clk_get(struct clk *clk)
>
> void __clk_put(struct clk *clk)
> {
> + struct module *owner;
> +
> if (!clk || WARN_ON_ONCE(IS_ERR(clk)))
> return;
>
> clk_prepare_lock();
> + owner = clk->owner;
> kref_put(&clk->ref, __clk_release);
> + module_put(owner);
> clk_prepare_unlock();
> -
> - module_put(clk->owner);
We don't need to move this call under the prepare lock though, right?
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
next prev parent reply other threads:[~2014-10-09 20:27 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-09 15:01 [PATCH v3 0/8] Per-user clock constraints Tomeu Vizoso
2014-10-09 15:01 ` [PATCH v3 1/8] MIPS: Alchemy: Remove direct access to prepare_count field of struct clk Tomeu Vizoso
2014-10-09 20:45 ` Stephen Boyd
2014-10-09 15:01 ` [PATCH v3 2/8] clk: Remove unused function __clk_get_prepare_count Tomeu Vizoso
2014-10-09 15:01 ` [PATCH v3 3/8] clk: Don't try to use a struct clk* after it could have been freed Tomeu Vizoso
2014-10-09 20:27 ` Stephen Boyd [this message]
2014-10-09 15:01 ` [PATCH v3 4/8] clk: Don't expose __clk_get_accuracy Tomeu Vizoso
2014-10-09 15:01 ` [PATCH v3 5/8] clk: change clk_debugfs_add_file to take a struct clk_hw Tomeu Vizoso
2014-10-09 15:01 ` [PATCH v3 6/8] clk: Change clk_ops->determine_rate to return a clk_hw as the best parent Tomeu Vizoso
2014-10-09 20:44 ` Stephen Boyd
2014-10-09 15:01 ` [PATCH v3 7/8] clk: Make clk API return per-user struct clk instances Tomeu Vizoso
2014-10-09 23:22 ` Stephen Boyd
2014-10-09 23:42 ` Kodiak Furr
2014-10-13 14:23 ` Tomeu Vizoso
2014-10-09 15:01 ` [PATCH v3 8/8] clk: Add floor and ceiling constraints to clock rates Tomeu Vizoso
2014-10-10 23:55 ` Stephen Boyd
2014-10-14 13:27 ` Tomeu Vizoso
2014-10-24 0:54 ` Stephen Boyd
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=20141009202733.GD5493@codeaurora.org \
--to=sboyd@codeaurora.org \
--cc=javier.martinez@collabora.co.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@linaro.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
Powered by JetHome