Skip to contentSkip to conversation

USB: core: fix device node leak

PATCH New Johan Hovold 1 participant 1 message May 29, 2017 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/2 USB: core: fix device node leak

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")
Cc stable <[email protected]> # v4.6
Cc Peter Chen <[email protected]>
---
 drivers/usb/core/usb.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/usb/core/usb.c +2 -0
index 28b053cacc90..62e1906bb2f3 100644
@@ -416,6 +416,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);
Signature · 1 line
2.13.0