[Top] [All Lists]

Re: [PATCH v3 2/5] clkdev: Fix race condition in clock lookup from devic

Subject: Re: [PATCH v3 2/5] clkdev: Fix race condition in clock lookup from device tree
From: Sylwester Nawrocki <>
Date: Fri, 23 Aug 2013 17:22:01 +0200
Cc: Sylwester Nawrocki <>,,,,,,,,,,,,,,,,,,
In-reply-to: <>
List-archive: <>
List-help: <>
List-id: linux-mips <>
List-owner: <>
List-post: <>
List-software: Ecartis version 1.0.0
List-subscribe: <>
List-unsubscribe: <>
Original-recipient: rfc822;
References: <> <>
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0
On 08/23/2013 05:03 PM, Sylwester Nawrocki wrote:
> 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. I.e. 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 <>

Oops, I missed to add:

Reviewed-by: Mike Turquette <>

> Acked-by: Russell King <>

<Prev in Thread] Current Thread [Next in Thread>