]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
gpio: shared: shorten the critical section in gpiochip_setup_shared()
authorBartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Wed, 25 Mar 2026 11:06:38 +0000 (12:06 +0100)
committerBartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Mon, 30 Mar 2026 07:51:15 +0000 (09:51 +0200)
commit310a4a9cbb17037668ea440f6a3964d00705b400
tree7d1acceb1c58ad5c71bd45d4ed0302b13af7ca54
parentc720fb57d56274213d027b3c5ab99080cf62a306
gpio: shared: shorten the critical section in gpiochip_setup_shared()

Commit 710abda58055 ("gpio: shared: call gpio_chip::of_xlate() if set")
introduced a critical section around the adjustmenet of entry->offset.
However this may cause a deadlock if we create the auxiliary shared
proxy devices with this lock taken. We only need to protect
entry->offset while it's read/written so shorten the critical section
and release the lock before creating the proxy device as the field in
question is no longer accessed at this point.

Fixes: 710abda58055 ("gpio: shared: call gpio_chip::of_xlate() if set")
Reported-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Link: https://patch.msgid.link/20260325-gpio-shared-deadlock-v1-1-e4e7a5319e95@oss.qualcomm.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
drivers/gpio/gpiolib-shared.c