]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerZefan Li <lizefan@huawei.com>
Tue, 14 Apr 2015 09:33:54 +0000 (17:33 +0800)
commitd08ee685d847a7f51ad271b089bbf9b2ee750c5c
tree49a17308e84c74e2375b42efe0bab1ed190dc673
parent5e4c2b6bfdc7d2aa17efad3123ef894543981a59
gpio: sysfs: fix gpio device-attribute leak

commit 0915e6feb38de8d3601819992a5bd050201a56fa upstream.

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: d8f388d8dc8d ("gpio: sysfs interface")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
[lizf: Backported to 3.4:
 - adjust filename
 - adjust context]
Signed-off-by: Zefan Li <lizefan@huawei.com>
drivers/gpio/gpiolib.c