gpio: sysfs: fix memory leaks
Subsystems (2)
cover gpio: sysfs: fix memory leaks
Here are two more fixes for long-standing memory leaks in the gpio sysfs interface (for v3.19).
Johan
Johan Hovold (2):
gpio: sysfs: fix memory leak in gpiod_export_link
gpio: sysfs: fix memory leak in gpiod_sysfs_set_active_low
drivers/gpio/gpiolib-sysfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Signature · 1 line
2.0.5
PATCH 1/2 gpio: sysfs: fix memory leak in gpiod_export_link
Fix memory leak in the gpio sysfs interface due to failure to drop reference to device returned by class_find_device when creating a link.
using sysfs links")
--- drivers/gpio/gpiolib-sysfs.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpio/gpiolib-sysfs.c +1 -0
@@ -648,6 +648,7 @@ int gpiod_export_link(struct device *dev, const char *name,if (tdev !=NULL ) { status =sysfs_create_link (&dev->kobj, &tdev->kobj, name); +put_device (tdev); }else { status = -ENODEV ; }
Signature · 1 line
2.0.5
Re: [PATCH 1/2] gpio: sysfs: fix memory leak in gpiod_export_link
Quoted 7 lines · Johan Hovold
Fix memory leak in the gpio sysfs interface due to failure to drop reference to device returned by
class_find_devicewhen creating a link.Fixes a4177ee7f1a8 ("gpiolib: allow exported GPIO nodes to be namedusing sysfs links")
Cc stable <[email protected]> # v2.6.32Signed-off-by Johan Hovold <[email protected]>
Patch applied.
Let's see if I get it into v3.19 properly...
Yours,
Linus Walleij
PATCH 2/2 gpio: sysfs: fix memory leak in gpiod_sysfs_set_active_low
In reply to Johan HovoldFix memory leak in the gpio sysfs interface due to failure to drop reference to device returned by class_find_device when setting the gpio-line polarity.
in sysfs")
--- drivers/gpio/gpiolib-sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpiolib-sysfs.c +1 -1
@@ -696,7 +696,7 @@ int gpiod_sysfs_set_active_low(struct gpio_desc *desc, int value) } status =sysfs_set_active_low (desc, dev, value); - +put_device (dev); unlock:mutex_unlock (&sysfs_lock);
Signature · 1 line
2.0.5
Re: [PATCH 2/2] gpio: sysfs: fix memory leak in gpiod_sysfs_set_active_low
Quoted 8 lines · Johan Hovold
Fix memory leak in the gpio sysfs interface due to failure to drop reference to device returned by
class_find_devicewhen setting the gpio-line polarity.Fixes 0769746183ca ("gpiolib: add support for changing value polarityin sysfs")
Cc stable <[email protected]> # v2.6.33Signed-off-by Johan Hovold <[email protected]>
Patch applied.
Yours,
Linus Walleij