From: Greg Kroah-Hartman Date: Wed, 28 Jan 2015 17:41:58 +0000 (-0800) Subject: updated queue-3.10/gpio-sysfs-fix-gpio-device-attribute-leak.patch X-Git-Tag: v3.10.67~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0ee418493b551d893df55b2f01f33f178c2bd760;p=thirdparty%2Fkernel%2Fstable-queue.git updated queue-3.10/gpio-sysfs-fix-gpio-device-attribute-leak.patch --- diff --git a/queue-3.10/gpio-sysfs-fix-gpio-device-attribute-leak.patch b/queue-3.10/gpio-sysfs-fix-gpio-device-attribute-leak.patch index febb420174f..cebd6ec688b 100644 --- a/queue-3.10/gpio-sysfs-fix-gpio-device-attribute-leak.patch +++ b/queue-3.10/gpio-sysfs-fix-gpio-device-attribute-leak.patch @@ -17,12 +17,9 @@ attribute-creation race with userspace for these attributes. Remove contingent attributes in export error path and on unexport. Fixes: d8f388d8dc8d ("gpio: sysfs interface") -Cc: stable # v2.6.27+ +Cc: stable # v2.6.27+ Signed-off-by: Johan Hovold Signed-off-by: Linus Walleij -[johan: fix leaks without device_create_with_groups, which wasn't -introduced until 3.11 ] -Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- @@ -57,7 +54,7 @@ Signed-off-by: Greg Kroah-Hartman static const struct attribute_group gpio_attr_group = { - .attrs = (struct attribute **) gpio_attrs, -+ .attrs = gpio_attrs, ++ .attrs = gpio_attrs, }; /* @@ -88,13 +85,13 @@ Signed-off-by: Greg Kroah-Hartman fail_unregister_device: device_unregister(dev); fail_unlock: -@@ -962,6 +966,9 @@ static void gpiod_unexport(struct gpio_d +@@ -971,6 +975,9 @@ static void gpiod_unexport(struct gpio_d + mutex_unlock(&sysfs_lock); - dev = class_find_device(&gpio_class, NULL, desc, match_export); - if (dev) { -+ device_remove_file(dev, &dev_attr_edge); -+ device_remove_file(dev, &dev_attr_direction); -+ sysfs_remove_group(&dev->kobj, &gpio_attr_group); - gpio_setup_irq(desc, dev, 0); - clear_bit(FLAG_EXPORT, &desc->flags); - } else + if (dev) { ++ device_remove_file(dev, &dev_attr_edge); ++ device_remove_file(dev, &dev_attr_direction); ++ sysfs_remove_group(&dev->kobj, &gpio_attr_group); + device_unregister(dev); + put_device(dev); + }