[3.16.y-ckt stable] Patch "clk: Don't try to use a struct clk* after it could have been freed" has been added to staging queue
Luis Henriques
luis.henriques at canonical.com
Mon Jan 26 14:33:04 UTC 2015
This is a note to let you know that I have just added a patch titled
clk: Don't try to use a struct clk* after it could have been freed
to the linux-3.16.y-queue branch of the 3.16.y-ckt extended stable tree
which can be found at:
http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.16.y-queue
This patch is scheduled to be released in version 3.16.7-ckt5.
If you, or anyone else, feels it should not be added to this tree, please
reply to this email.
For more information about the 3.16.y-ckt tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable
Thanks.
-Luis
------
>From cf211fafaa46486cebf287f50f2a32cf0dbc0929 Mon Sep 17 00:00:00 2001
From: Tomeu Vizoso <tomeu.vizoso at collabora.com>
Date: Tue, 2 Dec 2014 08:54:19 +0100
Subject: clk: Don't try to use a struct clk* after it could have been freed
commit 10cdfe54dab034311c8e2fad9ba2dffbe616caa9 upstream.
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 at collabora.com>
Fixes: fcb0ee6a3d33 ("clk: Implement clk_unregister")
Reviewed-by: Stephen Boyd <sboyd at codeaurora.org>
Signed-off-by: Michael Turquette <mturquette at linaro.org>
Signed-off-by: Luis Henriques <luis.henriques at canonical.com>
---
drivers/clk/clk.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 4cc83ef7ef61..1dee8d2086fb 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -2234,14 +2234,17 @@ 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);
clk_prepare_unlock();
- module_put(clk->owner);
+ module_put(owner);
}
/*** clk rate change notifiers ***/
--
2.1.4
More information about the kernel-team
mailing list