diff options
| author | 2026-11-20 04:55:41 +0100 | |
|---|---|---|
| committer | 2026-11-20 04:55:41 +0100 | |
| commit | e0216f30e1d34812354ee0cd6e91711bbf704bbe (patch) | |
| tree | e421b4a0176752a5de90a8d4caf9eb4f4fa5cd06 /systemd | |
| parent | a9e71086d97a24725c8bd35cb5db7f1c7ce09ed5 (diff) | |
| download | usbmuxd-e0216f30e1d34812354ee0cd6e91711bbf704bbe.tar.gz usbmuxd-e0216f30e1d34812354ee0cd6e91711bbf704bbe.tar.bz2 | |
usb: Tie init-time control transfers to the device lifetime
The control transfers used during device initialization (language ID,
serial number, get/switch mode) were not tracked anywhere. If the device
was unplugged meanwhile, reap_dead_devices() could free the usb_device
while one of these transfers was still pending, and the callback would
then dereference freed memory. Callbacks also did not check whether the
device was still alive, so a disconnected device could still reach
device_add() or be "initialized in current mode" after a cancel. A failed
language ID or serial transfer left the device in the list as alive.
- Track these transfers in a new usb_device.ctrl_xfers collection and
cancel/wait for them in usb_disconnect(), like RX/TX transfers.
- Store the usb_device in mode_context instead of looking it up by
bus/address, which could match a different device after a replug.
- Abort initialization in the callbacks if the device is no longer alive.
- Mark the device dead when the language ID or serial request fails, so
it gets reaped.
- Free the buffer, transfer and context on failed vendor-specific
submits.
Diffstat (limited to 'systemd')
0 files changed, 0 insertions, 0 deletions
