usb: core: port: Deattach Type-C connector on component unbind
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
usb: core: port: Deattach Type-C connector on component unbind
connector_unbind() is the mirror of connector_bind(), but it is missing the symmetric call to typec_deattach() that connector_bind() makes via:
if (port_dev->child) typec_attach(port_dev->connector, &port_dev->child->dev);
When a Thunderbolt dock is unplugged, two teardown paths race:
1. The component framework calls connector_unbind() first, which sets port_dev->connector = NULL without calling typec_deattach(). This leaves port->usb2_dev/port->usb3_dev in struct typec_port pointing at the USB device that is about to be freed.
2. usb_disconnect() then calls typec_deattach(port_dev->connector, ...), but port_dev->connector is already NULL, so the call is a no-op and port->usb2_dev is never cleared.
3. Concurrently, UCSI detects a PD partner-disconnect event and calls typec_unregister_partner(), which reads port->usb2_dev (now a dangling pointer to freed memory) and passes it to typec_partner_unlink_device() -> sysfs_remove_link() -> dev_name() on the freed device, corrupting the typec/UCSI partner state.
From the CVE record · Linux
The Linux kernel's USB Type-C connector teardown can leave a pointer to a freed USB device when a Thunderbolt dock is unplugged. If teardown races with a UCSI partner-disconnect event, the stale pointer can corrupt partner state or cause a use-after-free; the dock's NIC may then fail to enumerate on the next hot-plug. The described trigger requires a dock unplug and concurrent events; the input does not establish an authentication requirement.
Engineers running Linux on systems with USB Type-C, UCSI and Thunderbolt docks should check their kernel; affected versions are not specified.