From: Sylwester Nawrocki Date: Fri, 23 Aug 2013 15:03:44 +0000 (+0200) Subject: clkdev: Fix race condition in clock lookup from device tree X-Git-Tag: v3.14-rc1~109^2~27^2^2~2 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3a3d2b0551d79ef476ef57424beeb8f68789fbcd;p=pandora-kernel.git clkdev: Fix race condition in clock lookup from device tree There is currently a race condition in the device tree part of clk_get() function, since the pointer returned from of_clk_get_by_name() may become invalid before __clk_get() call. E.g. due to the clock provider driver remove() callback being called in between of_clk_get_by_name() and __clk_get(). Fix this by doing both the look up and __clk_get() operations with the clock providers list mutex held. This ensures that the clock pointer returned from __of_clk_get_from_provider() call and passed to __clk_get() is valid, as long as the clock supplier module first removes its clock provider instance and then does clk_unregister() on the corresponding clocks. Signed-off-by: Sylwester Nawrocki Signed-off-by: Kyungmin Park Reviewed-by: Mike Turquette Acked-by: Russell King --- Reading git-diff-tree failed