Module Name: src Committed By: riastradh Date: Tue Sep 7 10:42:34 UTC 2021
Modified Files: src/sys/dev/usb: ugen.c Log Message: ugen(4): Fix race of ugenopen against itself. Even though we have the kernel lock held, a sleep during kmem_alloc or usbd_open_pipe could allow another ugenopen to run concurrently before we have marked the endpoint opened. To avoid this, mark the endpoint open immediately (while we still have the kernel lock held and before any sleeps, so there is no TOCTOU error here), and then revert on unwind in the event of failure. To generate a diff of this commit: cvs rdiff -u -r1.159 -r1.160 src/sys/dev/usb/ugen.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.