mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 12:17:12 +09:00
gpio: sysfs: fix memory leak in gpiod_export_link
commit0f303db08dupstream. 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:a4177ee7f1("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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
87dc7c99c7
commit
d0d1f54d36
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user