]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
updated queue-3.10/gpio-sysfs-fix-gpio-device-attribute-leak.patch
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 28 Jan 2015 17:41:58 +0000 (09:41 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 28 Jan 2015 17:41:58 +0000 (09:41 -0800)
queue-3.10/gpio-sysfs-fix-gpio-device-attribute-leak.patch

index febb420174fa1f43a76816bba81ccfa0bd099de4..cebd6ec688b029a2d447483253f968ce4cbbb7fa 100644 (file)
@@ -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 <stable@vger.kernel.org> # v2.6.27+
+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>
-[johan: fix leaks without device_create_with_groups, which wasn't
-introduced until 3.11 ]
-Signed-off-by: Johan Hovold <johan@kernel.org>
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 
 ---
@@ -57,7 +54,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  
  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 <gregkh@linuxfoundation.org>
  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);
+       }