From: Johan Hovold Date: Tue, 6 Jun 2017 15:58:58 +0000 (+0200) Subject: USB: core: fix device node leak X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d84e328c0243baf944bbf156209c6ec5d69bd409;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git 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 Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- 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);