Commit ad55af95 authored by Johan Hovold's avatar Johan Hovold Committed by Jiri Slaby

gpio: sysfs: fix memory leak in gpiod_export_link

commit 0f303db0 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: a4177ee7 ("gpiolib: allow exported GPIO nodes to be named using sysfs links")
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
parent 1c2c2627
......@@ -864,6 +864,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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment