diff options
author | Johan Hovold <johan@kernel.org> | 2015-01-26 12:02:45 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-02-11 14:48:16 +0800 |
commit | d0d1f54d367f959bc7484422fb51f61c00977a64 (patch) | |
tree | 62ce12cbdbe1c19ad222d72b6acfb8fc145521d9 | |
parent | 87dc7c99c72e49461fba277c81871525700821fb (diff) | |
download | lwn-d0d1f54d367f959bc7484422fb51f61c00977a64.tar.gz lwn-d0d1f54d367f959bc7484422fb51f61c00977a64.zip |
gpio: sysfs: fix memory leak in gpiod_export_link
commit 0f303db08df0df9bd0966443ad6001e63960af16 upstream.
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.
Fixes: a4177ee7f1a8 ("gpiolib: allow exported GPIO nodes to be named using sysfs links")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/gpio/gpiolib.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 1d74a80e031e..6dd7df80ae20 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -874,6 +874,7 @@ static 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; } |