gpio: sysfs: fix gpio attribute-creation race
authorJohan Hovold <johan@kernel.org>
Tue, 13 Jan 2015 12:00:06 +0000 (13:00 +0100)
committerBen Hutchings <ben@decadent.org.uk>
Fri, 20 Feb 2015 00:49:38 +0000 (00:49 +0000)
commita10ff58e82582898690f3f2328ef5ef772c2a0b1
tree88de3baa3e52dc92d62a3b168b54a84b702a1f4d
parent91111b535d9d2b7927b59639e738d395a9f835c0
gpio: sysfs: fix gpio attribute-creation race

commit ebbeba120ab2ec6ac5f3afc1425ec6ff0b77ad6f upstream.

Fix attribute-creation race with userspace by using the default group
to create also the contingent gpio device attributes.

Fixes: d8f388d8dc8d ("gpio: sysfs interface")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
[bwh: Backported to 3.2:
 - Adjust filenames, context
 - Use gpio_to_desc(), not gpiod_to_desc(), in gpio_is_visible()
 - gpio_is_visible() must return mode_t]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/gpio/gpiolib.c