diff options
| author | Johan Hovold <johan@kernel.org> | 2026-10-15 09:48:31 +0200 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2026-10-17 12:39:44 +0200 |
| commit | 9cbbd0c18603a18b01abcdaeee24c133db2e9f2e (patch) | |
| tree | affbc57da0b6843a5c9f5fc8aa9cdd5777c1efc8 | |
| parent | 893584e7e390c44bf547235749c72f931108a2d7 (diff) | |
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:
524134d42231 ("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>
| -rw-r--r-- | drivers/usb/core/message.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 0cd6dd2b6334..8c4f97c6e9f9 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c @@ -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); |
