summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2017-06-06 17:58:58 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-07-12 15:01:03 +0200
commitd84e328c0243baf944bbf156209c6ec5d69bd409 (patch)
tree3982d7646954f41f8108a07435fe3d01732788b9 /drivers
parent18b3abb543053ea26528f5be5b96414fef983322 (diff)
downloadlinux-stable-d84e328c0243baf944bbf156209c6ec5d69bd409.tar.gz
linux-stable-d84e328c0243baf944bbf156209c6ec5d69bd409.tar.bz2
linux-stable-d84e328c0243baf944bbf156209c6ec5d69bd409.zip
USB: core: fix device node leak
commit e271b2c909a22a2c13b2d5f77f2ce0091b74540c upstream. Make sure to release any OF device-node reference taken when creating the USB device. Note that we currently do not hold a reference to the root hub device-tree node (i.e. the parent controller node). Fixes: 69bec7259853 ("USB: core: let USB device know device node") Acked-by: Peter Chen <peter.chen@nxp.com> Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/core/usb.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 592151461017..eaf1c3b06f02 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -279,6 +279,8 @@ static void usb_release_dev(struct device *dev)
usb_destroy_configuration(udev);
usb_release_bos_descriptor(udev);
+ if (udev->parent)
+ of_node_put(dev->of_node);
usb_put_hcd(hcd);
kfree(udev->product);
kfree(udev->manufacturer);