]> 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:34:19 +0000 (04:34 -0800)
commitce44640bef61c4b26e2e52a113aa55f3d743b67b
tree892110b83e265026f1527af11f9e196f69d6161d
parentfdbfd52bd8b85ed6783365ff54c82ab7067bd61b
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