projects/linux·commit 49d2ca84

gpio: sysfs: fix memory leak in gpiod_sysfs_set_active_low

49d2ca84 · Johan Hovold <[email protected]> · 2015-01-26 12:02:46 +01:00

Fix 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.

Fixes: 0769746183ca ("gpiolib: add support for changing value polarity
in sysfs")
Cc: stable <[email protected]>	# v2.6.33
Signed-off-by: Johan Hovold <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
Commit
49d2ca84e433dab854c7a866bc6add09cfab682d
Parents
0f303db0

Changes

1 files changed · +1 −1

FileStatusAddDelContent
drivers/gpio/gpiolib-sysfs.cmodified+1−1View file

drivers/gpio/gpiolib-sysfs.c

View file
diff --git a/drivers/gpio/gpiolib-sysfs.c b/drivers/gpio/gpiolib-sysfs.c
index 4667830..7722ed5 100644
--- a/drivers/gpio/gpiolib-sysfs.c
+++ b/drivers/gpio/gpiolib-sysfs.c
@@ -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);