Skip to content
Commit e65a0dc2 authored by Hagar Hemdan's avatar Hagar Hemdan Committed by Greg Kroah-Hartman
Browse files

pinctrl: fix deadlock in create_pinctrl() when handling -EPROBE_DEFER



[ Upstream commit adec57ff ]

In create_pinctrl(), pinctrl_maps_mutex is acquired before calling
add_setting(). If add_setting() returns -EPROBE_DEFER, create_pinctrl()
calls pinctrl_free(). However, pinctrl_free() attempts to acquire
pinctrl_maps_mutex, which is already held by create_pinctrl(), leading to
a potential deadlock.

This patch resolves the issue by releasing pinctrl_maps_mutex before
calling pinctrl_free(), preventing the deadlock.

This bug was discovered and resolved using Coverity Static Analysis
Security Testing (SAST) by Synopsys, Inc.

Fixes: 42fed7ba ("pinctrl: move subsystem mutex to pinctrl_dev struct")
Suggested-by: default avatarMaximilian Heyne <mheyne@amazon.de>
Signed-off-by: default avatarHagar Hemdan <hagarhem@amazon.com>
Link: https://lore.kernel.org/r/20240604085838.3344-1-hagarhem@amazon.com


Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 2a28c0f4
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment