gpio: take the SRCU read lock in gpiod_hog()
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Wed, 14 Feb 2024 08:44:16 +0000 (09:44 +0100)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Thu, 15 Feb 2024 07:39:13 +0000 (08:39 +0100)
commit815a1b5a6da4bedb29a1e15a94a042e525b0ba96
treed10e5a4818c8613bfa624f3b66604d9b5ea8d774
parente3f927f2b0a23902923c768f07e274a1373216f3
gpio: take the SRCU read lock in gpiod_hog()

gpiod_hog() may be called without the gpio_device SRCU read lock taken
so we need to do it here as well. It's alright if someone else is
already holding the lock as SRCU read critical sections can be nested.

Fixes: d83cee3d2bb1 ("gpio: protect the pointer to gpio_chip in gpio_device with SRCU")
Reported-by: kernel test robot <oliver.sang@intel.com>
Closes: https://lore.kernel.org/oe-lkp/202402122234.d85cca9b-lkp@intel.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Paul E. McKenney <paulmck@kernel.org>
drivers/gpio/gpiolib.c