diff options
author | Rob Herring (Arm) <robh@kernel.org> | 2024-12-17 12:11:40 -0600 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-02-08 10:01:15 +0100 |
commit | 44e906fd7089fbbd171dc55ebab30f4a4e00eabc (patch) | |
tree | 96a0d59f687ab701f868e5238f066b21724ffd2e /samples/landlock | |
parent | aaac7fc860add8924058de15ed5e4d0cf47c27df (diff) | |
download | linux-44e906fd7089fbbd171dc55ebab30f4a4e00eabc.tar.gz linux-44e906fd7089fbbd171dc55ebab30f4a4e00eabc.tar.bz2 linux-44e906fd7089fbbd171dc55ebab30f4a4e00eabc.zip |
mfd: syscon: Fix race in device_node_get_regmap()
[ Upstream commit 805f7aaf7fee14a57b56af01d270edf6c10765e8 ]
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")
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Tested-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Tested-by: Will McVicker <willmcvicker@google.com>
Tested-by: Pankaj Dubey <pankaj.dubey@samsung.com>
Reviewed-by: Pankaj Dubey <pankaj.dubey@samsung.com>
Link: https://lore.kernel.org/r/20241217-syscon-fixes-v2-1-4f56d750541d@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'samples/landlock')
0 files changed, 0 insertions, 0 deletions