Page MenuHomeFreeBSD

libusb: don't treat EINVAL from USB_FS_COMPLETE as device detach
ClosedPublic

Authored by aokblast on Jun 11 2026, 3:00 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Sep 17, 11:01 PM
Unknown Object (File)
Sun, Sep 6, 1:57 AM
Unknown Object (File)
Sun, Sep 6, 12:23 AM
Unknown Object (File)
Fri, Sep 4, 12:47 PM
Unknown Object (File)
Fri, Sep 4, 9:27 AM
Unknown Object (File)
Fri, Sep 4, 8:55 AM
Unknown Object (File)
Fri, Sep 4, 5:47 AM
Unknown Object (File)
Fri, Sep 4, 1:17 AM
Subscribers

Details

Summary

ugen20_process() treats any non-EBUSY errno returned by USB_FS_COMPLETE
as device detach and returns LIBUSB20_ERROR_OTHER. This causes libusb10
to set device_is_gone and fail all subsequent transfer with
LIBUSB_ERROR_NO_DEVICE.

However, USB_FS_COMPLETE can also return EINVAL when a completion
references an endpoint that no longer exists, for example after
SET_INTERFACE or SET_CONFIG removes and recreates endpoints. This is a
transient condition and does not indicate device detach.

Treat EINVAL the same as EBUSY and stop draining completions. This
prevents a guest selecting an isochronous streaming altsetting from
permanently breaking the passed-through device.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 73822
Build 70705: arc lint + arc unit