USB: core: document purpose of interface parent reference

USB interfaces hold a reference to their parent USB device to make sure
they do not outlive the parent.

Add a comment explaining that this reference is specifically needed for
asynchronous device resets and the device type need_parent_lock feature
(to allow driver core to lock the parent when only holding a reference
to the interface).

See commits:

  524134d422 ("USB: don't cancel queued resets when unbinding drivers")
  0f554506a3fc ("driver core: fix parent lock use-after-free on USB disconnect")

for further details.

Signed-off-by: Johan Hovold <johan@kernel.org>
Reviewed-by: Danilo Krummrich <dakr@kernel.org>
Link: https://patch.msgid.link/20261015074831.1418677-1-johan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Johan Hovold authored and Greg Kroah-Hartman committed 2026-10-17 12:39:44 +02:00
1 parent 893584e7e3
commit 9cbbd0c186
1 file changed
+5
+5
View File
@@ -2208,6 +2208,11 @@ free_interfaces:
pm_runtime_no_callbacks(&intf->dev);
dev_set_name(&intf->dev, "%d-%s:%d.%d", dev->bus->busnum,
dev->devpath, configuration, ifnum);
/*
* Make sure the interface does not outlive its parent (e.g.
* as needed for usb_queue_reset_device() and
* usb_if_device_type->need_parent_lock).
*/
usb_get_dev(dev);
}
kfree(new_interfaces);