]> git.baikalelectronics.ru Git - kernel.git/commit
gpio: sysfs: fix gpio device-attribute leak
authorJohan Hovold <johan@kernel.org>
Tue, 13 Jan 2015 12:00:05 +0000 (13:00 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Thu, 15 Jan 2015 16:20:15 +0000 (17:20 +0100)
commit518d85a4e7223f1c011bc57e4db3f41a8343ba38
tree246c1724e7a827583fa70147869b4bcbb15b883c
parente28c126b28dfa1ff6e4b7695d7b1c4c9693c98ef
gpio: sysfs: fix gpio device-attribute leak

The gpio device attributes were never destroyed when the gpio was
unexported (or on export failures).

Use device_create_with_groups() to create the default device attributes
of the gpio class device. Note that this also fixes the
attribute-creation race with userspace for these attributes.

Remove contingent attributes in export error path and on unexport.

Fixes: 601455711103 ("gpio: sysfs interface")
Cc: stable <stable@vger.kernel.org> # v2.6.27+
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpiolib-sysfs.c