Module Name: src Committed By: skrll Date: Thu Jan 2 15:54:10 UTC 2014
Modified Files: src/sys/external/bsd/dwc2: dwc2.c src/sys/external/bsd/dwc2/dist: dwc2_hcd.c dwc2_hcdqueue.c Log Message: Protect access of urb->hcpriv by adapting the following change from the Raspberry PI dwc_otg driver. https://github.com/raspberrypi/linux/commit/38753ce72d4f10d5d0f1ed27fa691a2ba8910941 dwc_otg: prevent OOPSes during device disconnects The dwc_otg_urb_enqueue function is thread-unsafe. In particular the access of urb->hcpriv, usb_hcd_link_urb_to_ep, dwc_otg_urb->qtd and friends does not occur within a critical section and so if a device was unplugged during activity there was a high chance that the usbcore hub_thread would try to disable the endpoint with partially- formed entries in the URB queue. This would result in BUG() or null pointer dereferences. Fix so that access of urb->hcpriv, enqueuing to the hardware and adding to usbcore endpoint URB lists is contained within a single critical section. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/external/bsd/dwc2/dwc2.c cvs rdiff -u -r1.9 -r1.10 src/sys/external/bsd/dwc2/dist/dwc2_hcd.c cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/dwc2/dist/dwc2_hcdqueue.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.