diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2015-03-02 15:45:41 +0000 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2015-05-06 11:58:02 +0100 |
commit | d5622a9c13752be46e6fcde9d31391ce0bb0598b (patch) | |
tree | 523015241b656260184db448979c8b2c11ece8ea /include/linux/clkdev.h | |
parent | b787f68c36d49bb1d9236f403813641efa74a031 (diff) | |
download | op-kernel-dev-d5622a9c13752be46e6fcde9d31391ce0bb0598b.zip op-kernel-dev-d5622a9c13752be46e6fcde9d31391ce0bb0598b.tar.gz |
clkdev: use clk_hw internally
clk_add_alias() calls clk_get() followed by clk_put() but in between
those two calls it saves away the struct clk pointer to a clk_lookup
structure. This leaves the 'clk' member of the clk_lookup pointing at
freed memory on configurations where CONFIG_COMMON_CLK=y. This is a
problem because clk_get_sys() will eventually try to dereference the
freed pointer by calling __clk_get_hw() on it. Fix this by saving away
the struct clk_hw pointer instead of the struct clk pointer so that when
we try to create a per-user struct clk in clk_get_sys() we don't
dereference a junk pointer.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'include/linux/clkdev.h')
-rw-r--r-- | include/linux/clkdev.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/clkdev.h b/include/linux/clkdev.h index 94bad77..3003afa 100644 --- a/include/linux/clkdev.h +++ b/include/linux/clkdev.h @@ -22,6 +22,7 @@ struct clk_lookup { const char *dev_id; const char *con_id; struct clk *clk; + struct clk_hw *clk_hw; }; #define CLKDEV_INIT(d, n, c) \ |