WSL2-Linux-Kernel/drivers/usb/host
Andiry Xu c2d7b49f42 USB: xHCI: prevent infinite loop when processing MSE event
When a xHC host is unable to handle isochronous transfer in the
interval, it reports a Missed Service Error event and skips some tds.

Currently xhci driver handles MSE event in the following ways:

1. When encounter a MSE event, set ep->skip flag, update event ring
   dequeue pointer and return.

2. When encounter the next event on this ep, the driver will run the
   do-while loop, fetch td from ep's td_list to find the td
   corresponding to this event.  All tds missed are marked as short
   transfer(-EXDEV).

The do-while loop will end in two ways:

1. If the td pointed by the event trb is found;

2. If the ep ring's td_list is empty.

However, if a buggy HW reports some unpredicted event (for example, an
overrun event following a MSE event while the ep ring is actually not
empty), the driver will never find the td, and it will loop until the
td_list is empty.

Unfortunately, the spinlock is dropped when give back a urb in the
do-while loop.  During the spinlock released period, the class driver
may still submit urbs and add tds to the td_list.  This may cause
disaster, since the td_list will never be empty and the loop never ends,
and the system hangs.

To fix this, count the number of TDs on the ep ring before skipping TDs,
and quit the loop when skipped that number of tds.  This guarantees the
do-while loop will end after certain number of cycles, and driver will
not be trapped in an infinite loop.

Signed-off-by: Andiry Xu <andiry.xu@amd.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-19 17:15:47 -07:00
..
whci treewide: Convert uses of struct resource to resource_size(ptr) 2011-06-10 14:55:36 +02:00
Kconfig
Makefile
ehci-ath79.c Merge branch 'master' into for-next 2011-07-11 14:15:55 +02:00
ehci-atmel.c
ehci-au1xxx.c
ehci-cns3xxx.c treewide: Convert uses of struct resource to resource_size(ptr) 2011-06-10 14:55:36 +02:00
ehci-dbg.c
ehci-fsl.c treewide: Convert uses of struct resource to resource_size(ptr) 2011-06-10 14:55:36 +02:00
ehci-fsl.h
ehci-grlib.c treewide: Convert uses of struct resource to resource_size(ptr) 2011-06-10 14:55:36 +02:00
ehci-hcd.c Merge branch 'usb-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6 2011-07-25 23:08:32 -07:00
ehci-hub.c USB: EHCI: Do not rely on PORT_SUSPEND to stop USB resuming in ehci_bus_resume(). 2011-08-22 13:38:52 -07:00
ehci-ixp4xx.c treewide: Convert uses of struct resource to resource_size(ptr) 2011-06-10 14:55:36 +02:00
ehci-lpm.c
ehci-mem.c
ehci-msm.c ehci-msm : use ehci_setup 2011-07-08 14:51:29 -07:00
ehci-mxc.c usb/ehci-mxc: add missing inclusion of mach/hardware.h 2011-08-08 12:34:45 -07:00
ehci-octeon.c treewide: Convert uses of struct resource to resource_size(ptr) 2011-06-10 14:55:36 +02:00
ehci-omap.c usb: host: ehci-omap: fix .remove and failure handling path of .probe(v1) 2011-08-01 22:06:48 +03:00
ehci-orion.c
ehci-pci.c
ehci-pmcmsp.c treewide: Convert uses of struct resource to resource_size(ptr) 2011-06-10 14:55:36 +02:00
ehci-ppc-of.c treewide: Convert uses of struct resource to resource_size(ptr) 2011-06-10 14:55:36 +02:00
ehci-ps3.c
ehci-q.c EHCI: fix direction handling for interrupt data toggles 2011-07-19 11:25:45 -07:00
ehci-s5p.c usb: s5p-ehci: fix a NULL pointer deference 2011-08-22 13:38:52 -07:00
ehci-sched.c USB: EHCI: Allow users to override 80% max periodic bandwidth 2011-07-08 14:51:33 -07:00
ehci-sh.c
ehci-spear.c
ehci-sysfs.c USB: EHCI: Allow users to override 80% max periodic bandwidth 2011-07-08 14:51:33 -07:00
ehci-tegra.c
ehci-vt8500.c
ehci-w90x900.c treewide: Convert uses of struct resource to resource_size(ptr) 2011-06-10 14:55:36 +02:00
ehci-xilinx-of.c treewide: Convert uses of struct resource to resource_size(ptr) 2011-06-10 14:55:36 +02:00
ehci.h EHCI: fix direction handling for interrupt data toggles 2011-07-19 11:25:45 -07:00
fhci-dbg.c
fhci-hcd.c treewide: Convert uses of struct resource to resource_size(ptr) 2011-06-10 14:55:36 +02:00
fhci-hub.c
fhci-mem.c
fhci-q.c
fhci-sched.c
fhci-tds.c
fhci.h
fsl-mph-dr-of.c
hwa-hc.c
imx21-dbg.c
imx21-hcd.c
imx21-hcd.h
isp116x-hcd.c
isp116x.h
isp1362-hcd.c
isp1362.h
isp1760-hcd.c usb/isp1760: Added missing call to usb_hcd_check_unlink_urb() during unlink 2011-08-08 12:34:48 -07:00
isp1760-hcd.h
isp1760-if.c
octeon2-common.c
ohci-at91.c
ohci-ath79.c treewide: Convert uses of struct resource to resource_size(ptr) 2011-06-10 14:55:36 +02:00
ohci-au1xxx.c
ohci-cns3xxx.c treewide: Convert uses of struct resource to resource_size(ptr) 2011-06-10 14:55:36 +02:00
ohci-da8xx.c treewide: Convert uses of struct resource to resource_size(ptr) 2011-06-10 14:55:36 +02:00
ohci-dbg.c
ohci-ep93xx.c
ohci-hcd.c USB: change maintainership of ohci-hcd and ehci-hcd 2011-06-15 17:44:56 -07:00
ohci-hub.c
ohci-jz4740.c
ohci-mem.c
ohci-octeon.c treewide: Convert uses of struct resource to resource_size(ptr) 2011-06-10 14:55:36 +02:00
ohci-omap.c
ohci-omap3.c
ohci-pci.c
ohci-pnx4008.c
ohci-pnx8550.c
ohci-ppc-of.c treewide: Convert uses of struct resource to resource_size(ptr) 2011-06-10 14:55:36 +02:00
ohci-ppc-soc.c treewide: Convert uses of struct resource to resource_size(ptr) 2011-06-10 14:55:36 +02:00
ohci-ps3.c
ohci-pxa27x.c drivers/usb/host/ohci-pxa27x.c: add missing clk_put 2011-06-07 09:07:47 -07:00
ohci-q.c
ohci-s3c2410.c
ohci-sa1111.c treewide: Convert uses of struct resource to resource_size(ptr) 2011-06-10 14:55:36 +02:00
ohci-sh.c usb: update email address in ohci-sh and r8a66597-hcd 2011-07-08 14:57:12 -07:00
ohci-sm501.c treewide: Convert uses of struct resource to resource_size(ptr) 2011-06-10 14:55:36 +02:00
ohci-spear.c
ohci-ssb.c Update my e-mail address 2011-07-07 15:18:01 +02:00
ohci-tmio.c treewide: Convert uses of struct resource to resource_size(ptr) 2011-06-10 14:55:36 +02:00
ohci.h
oxu210hp-hcd.c treewide: Convert uses of struct resource to resource_size(ptr) 2011-06-10 14:55:36 +02:00
oxu210hp.h
pci-quirks.c usb/host/pci-quirks.c: correct annotation of `ehci_dmi_nohandoff_table' 2011-08-08 14:00:14 -07:00
pci-quirks.h
r8a66597-hcd.c Merge branch 'usb-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6 2011-07-25 23:08:32 -07:00
r8a66597.h usb: r8a66597-hcd: add function for external controller 2011-07-08 14:57:11 -07:00
sl811-hcd.c
sl811.h
sl811_cs.c
u132-hcd.c
uhci-debug.c
uhci-grlib.c treewide: Convert uses of struct resource to resource_size(ptr) 2011-06-10 14:55:36 +02:00
uhci-hcd.c
uhci-hcd.h
uhci-hub.c
uhci-pci.c
uhci-q.c
xhci-dbg.c Merge 3.0-rc2 into usb-linus as it's needed by some USB patches 2011-06-14 06:51:23 -07:00
xhci-ext-caps.h
xhci-hub.c USB: xhci: Set change bit when warm reset change is set. 2011-09-19 17:15:46 -07:00
xhci-mem.c Merge branch 'usb-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6 2011-07-25 23:08:32 -07:00
xhci-pci.c xhci: Add reset on resume quirk for asrock p67 host 2011-06-17 11:28:19 -07:00
xhci-ring.c USB: xHCI: prevent infinite loop when processing MSE event 2011-09-19 17:15:47 -07:00
xhci.c xhci: Remove TDs from TD lists when URBs are canceled. 2011-08-09 14:49:25 -07:00
xhci.h Merge branch 'usb-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6 2011-07-25 23:08:32 -07:00