[PATCH v2 1/3] mfd: syscon: Fix race in device_node_get_regmap()
Pankaj Dubey
pankaj.dubey at samsung.com
Sun Dec 22 18:14:25 PST 2024
> -----Original Message-----
> From: Rob Herring (Arm) <robh at kernel.org>
> Sent: Tuesday, December 17, 2024 11:42 PM
> To: Lee Jones <lee at kernel.org>; Arnd Bergmann <arnd at arndb.de>; Pankaj
> Dubey <pankaj.dubey at samsung.com>; Heiko Stuebner <heiko at sntech.de>;
> Liviu Dudau <liviu.dudau at arm.com>; Sudeep Holla <sudeep.holla at arm.com>;
> Lorenzo Pieralisi <lpieralisi at kernel.org>
> Cc: Peter Griffin <peter.griffin at linaro.org>; Will McVicker
> <willmcvicker at google.com>; John Madieu <john.madieu.xa at bp.renesas.com>;
> Krzysztof Kozlowski <krzysztof.kozlowski at linaro.org>; linux-
> kernel at vger.kernel.org; linux-arm-kernel at lists.infradead.org
> Subject: [PATCH v2 1/3] mfd: syscon: Fix race in device_node_get_regmap()
>
> It is possible for multiple, simultaneous callers calling
> device_node_get_regmap() with the same node to fail to find an entry in the
> syscon_list. There is a period of time while the first caller is calling
> of_syscon_register() that subsequent callers also fail to find an entry in the
> syscon_list and then call of_syscon_register() a second time.
>
> Fix this by keeping the lock held until after of_syscon_register() completes and
> adds the node to syscon_list. Convert the spinlock to a mutex as many of the
> functions called in of_syscon_register() such as
> kzalloc() and of_clk_get() may sleep.
>
> Fixes: bdb0066df96e ("mfd: syscon: Decouple syscon interface from platform
> devices")
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski at linaro.org>
> Tested-by: Krzysztof Kozlowski <krzysztof.kozlowski at linaro.org>
> Signed-off-by: Rob Herring (Arm) <robh at kernel.org>
> ---
Reviewed-by: Pankaj Dubey <pankaj.dubey at samsung.com>
More information about the linux-arm-kernel
mailing list