xhci: Make handover code more robust
authorMatthew Garrett <mjg@redhat.com>
Tue, 14 Aug 2012 20:44:49 +0000 (16:44 -0400)
committerBen Hutchings <ben@decadent.org.uk>
Wed, 19 Sep 2012 14:05:12 +0000 (15:05 +0100)
commit43e3806177660ebb1fdd4ac8aedb0e62abfbe3e4
treee17b1c4a3108b8cfdf1cd9be4ff0f320a4d92ad6
parent52fa5d9c8c956ee587389bd662106a770de42827
xhci: Make handover code more robust

commit e955a1cd086de4d165ae0f4c7be7289d84b63bdc upstream.

My test platform (Intel DX79SI) boots reliably under BIOS, but frequently
crashes when booting via UEFI. I finally tracked this down to the xhci
handoff code. It seems that reads from the device occasionally just return
0xff, resulting in xhci_find_next_cap_offset generating a value that's
larger than the resource region. We then oops when attempting to read the
value. Sanity checking that value lets us avoid the crash.

I've no idea what's causing the underlying problem, and xhci still doesn't
actually *work* even with this, but the machine at least boots which will
probably make further debugging easier.

This should be backported to kernels as old as 2.6.31, that contain the
commit 66d4eadd8d067269ea8fead1a50fe87c2979a80d "USB: xhci: BIOS handoff
and HW initialization."

Signed-off-by: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/usb/host/pci-quirks.c