pinctrl: qcom: lpass-lpi: fix concurrent register updates
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Fri, 13 Oct 2023 14:57:05 +0000 (16:57 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Mon, 16 Oct 2023 12:56:49 +0000 (14:56 +0200)
commitc8befdc411e5fd1bf95a13e8744c8ca79b412bee
treece583c8ef4ce55ac5c811033df62c01331d8444f
parent58720809f52779dc0f08e53e54b014209d13eebb
pinctrl: qcom: lpass-lpi: fix concurrent register updates

The Qualcomm LPASS LPI pin controller driver uses one lock for guarding
Read-Modify-Write code for slew rate registers.  However the pin
configuration and muxing registers have exactly the same RMW code but
are not protected.

Pin controller framework does not provide locking here, thus it is
possible to trigger simultaneous change of pin configuration registers
resulting in non-atomic changes.

Protect from concurrent access by re-using the same lock used to cover
the slew rate register.  Using the same lock instead of adding second
one will make more sense, once we add support for newer Qualcomm SoC,
where slew rate is configured in the same register as pin
configuration/muxing.

Fixes: 6e261d1090d6 ("pinctrl: qcom: Add sm8250 lpass lpi pinctrl driver")
Cc: stable@vger.kernel.org
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20231013145705.219954-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/qcom/pinctrl-lpass-lpi.c