]> git.baikalelectronics.ru Git - kernel.git/commit
gpio: sysfs: fix race between gpiod export and unexport
authorJohan Hovold <johan@kernel.org>
Mon, 4 May 2015 15:10:45 +0000 (17:10 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Tue, 12 May 2015 08:47:44 +0000 (10:47 +0200)
commit4d4386cd2fe86e3e5a87c5f60877274620b97421
tree960f5d1486f52fff62c687dcbbcf9d9ce650c01a
parent1cbd2d20232f02d666bfc94d5433e40cd01afc2a
gpio: sysfs: fix race between gpiod export and unexport

Make sure to deregister the class device (and release the irq) while
holding the sysfs lock in gpio_unexport to prevent racing with
gpio_export.

Note that this requires the recently introduced per-gpio locking to
avoid a deadlock with the kernfs active protection when waiting for the
attribute operations to drain during deregistration.

Signed-off-by: Johan Hovold <johan@kernel.org>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpiolib-sysfs.c