Module Name: src Committed By: riastradh Date: Sun Jun 13 00:13:24 UTC 2021
Modified Files: src/sys/dev/usb: usb_subr.c usbdi.c usbdivar.h Log Message: usb(4): Tighten interface locking and pipe references. - Just use a reference count, not a list of pipes. - Take the reference in usbd_open_pipe*, before we even look up the endpoint by address; the endpoint is not stable until we hold the interface and prevent usbd_set_interface. - Make opening pipes just fail if usbd_set_interface is in progress. => No need to block -- might block for a while, and this is essentially a driver error rather than a legitimate reason to block. => This should maybe be a kassert, but it's not clear that ugen(4) doesn't have a user-triggerable path to that kassert, so let's keep it as a graceful failure for now until someone can audit ugen(4) and make an informed decision. - No need for a separate interface pipe lock; just use the bus lock. This is a little bit longer than before, but makes the bracketed nature of the references a little clearer and introduces more kasserts to detect mistakes with internal API usage. To generate a diff of this commit: cvs rdiff -u -r1.260 -r1.261 src/sys/dev/usb/usb_subr.c cvs rdiff -u -r1.215 -r1.216 src/sys/dev/usb/usbdi.c cvs rdiff -u -r1.127 -r1.128 src/sys/dev/usb/usbdivar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.