• Johan Hovold's avatar
    gpio: sysfs: fix gpio device-attribute leak · 0915e6fe
    Johan Hovold authored
    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: d8f388d8 ("gpio: sysfs interface")
    Cc: stable <stable@vger.kernel.org>	# v2.6.27+
    Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
    Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
    0915e6fe
gpiolib-sysfs.c 19.3 KB