]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
gpiolib: protect gpio_chip with SRCU in array_info paths in multi get/set
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Sat, 15 Feb 2025 09:56:55 +0000 (10:56 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Feb 2025 12:30:21 +0000 (04:30 -0800)
commit6f3edf2d50c93c58b3be6838f3d7cccb3aa8c43e
tree71d82780b675e793b238a253223ad1f3f488ac80
parent506b9b5e8c2d2a411ea8fe361333f5081c56d23a
gpiolib: protect gpio_chip with SRCU in array_info paths in multi get/set

commit 81570d6a7ad37033c7895811551a5a9023706eda upstream.

During the locking rework in GPIOLIB, we omitted one important use-case,
namely: setting and getting values for GPIO descriptor arrays with
array_info present.

This patch does two things: first it makes struct gpio_array store the
address of the underlying GPIO device and not chip. Next: it protects
the chip with SRCU from removal in gpiod_get_array_value_complex() and
gpiod_set_array_value_complex().

Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20250215095655.23152-1-brgl@bgdev.pl
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpio/gpiolib.c
drivers/gpio/gpiolib.h