diff options
author | Oleksij Rempel <linux@rempel-privat.de> | 2013-07-21 09:36:19 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-08-04 04:50:46 -0400 |
commit | 10a1c13241f682cdc866f2aa8a0e5c5373470ecb (patch) | |
tree | 756374b512fc14b315e30fac4416f52036673904 | |
parent | a875d82eda58712d81caf78ebb515fb072187138 (diff) |
xhci: fix null pointer dereference on ring_doorbell_for_active_rings
commit d66eaf9f89502971fddcb0de550b01fa6f409d83 upstream.
in some cases where device is attched to xhci port and do not responding,
for example ath9k_htc with stalled firmware, kernel will
crash on ring_doorbell_for_active_rings.
This patch check if pointer exist before it is used.
This patch should be backported to kernels as old as 2.6.35, that
contain the commit e9df17eb1408cfafa3d1844bfc7f22c7237b31b8 "USB: xhci:
Correct assumptions about number of rings per endpoint"
Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/usb/host/xhci-ring.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 1969c001b3f9..cc3bfc5d590d 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -434,7 +434,7 @@ static void ring_doorbell_for_active_rings(struct xhci_hcd *xhci, | |||
434 | 434 | ||
435 | /* A ring has pending URBs if its TD list is not empty */ | 435 | /* A ring has pending URBs if its TD list is not empty */ |
436 | if (!(ep->ep_state & EP_HAS_STREAMS)) { | 436 | if (!(ep->ep_state & EP_HAS_STREAMS)) { |
437 | if (!(list_empty(&ep->ring->td_list))) | 437 | if (ep->ring && !(list_empty(&ep->ring->td_list))) |
438 | xhci_ring_ep_doorbell(xhci, slot_id, ep_index, 0); | 438 | xhci_ring_ep_doorbell(xhci, slot_id, ep_index, 0); |
439 | return; | 439 | return; |
440 | } | 440 | } |