]> asedeno.scripts.mit.edu Git - linux.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)
commit72eba6f66a0017356380eec64db8780305aee2b8
tree960f5d1486f52fff62c687dcbbcf9d9ce650c01a
parent6ffcb7971486ea4f1eb14f07f8efb0b6f829a23c
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