]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
clkdev: use clk_hw internally
authorRussell King <rmk+kernel@arm.linux.org.uk>
Mon, 2 Mar 2015 15:45:41 +0000 (15:45 +0000)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Wed, 6 May 2015 10:58:02 +0000 (11:58 +0100)
commitd5622a9c13752be46e6fcde9d31391ce0bb0598b
tree523015241b656260184db448979c8b2c11ece8ea
parentb787f68c36d49bb1d9236f403813641efa74a031
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>
drivers/clk/clkdev.c
include/linux/clkdev.h