diff options
author | Sarah Sharp <sarah.a.sharp@linux.intel.com> | 2013-04-23 17:11:14 -0700 |
---|---|---|
committer | Sarah Sharp <sarah.a.sharp@linux.intel.com> | 2013-06-14 13:50:17 -0700 |
commit | 92f8e76769c687a7c38c5067ff375c187666ac18 (patch) | |
tree | 47b8efd7542d4e4c4dce5050317cd26fc0fa0602 /drivers/usb/host/xhci-ring.c | |
parent | 29f9d54b63a6186f1bed3fc15eeab7f98947eebd (diff) |
xhci: Remove BUG_ON in xhci_get_input_control_ctx.
Fail gracefully, instead of causing the kernel to panic, if the input
control context doesn't have the right type (XHCI_CTX_TYPE_INPUT). Push
finding the pointer to the input control context up into functions that
can fail.
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: John Youn <johnyoun@synopsys.com>
Diffstat (limited to 'drivers/usb/host/xhci-ring.c')
-rw-r--r-- | drivers/usb/host/xhci-ring.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index e02b90746e8..1e57eafa691 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -1424,6 +1424,10 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, */ ctrl_ctx = xhci_get_input_control_ctx(xhci, virt_dev->in_ctx); + if (!ctrl_ctx) { + xhci_warn(xhci, "Could not get input context, bad type.\n"); + break; + } /* Input ctx add_flags are the endpoint index plus one */ ep_index = xhci_last_valid_endpoint(le32_to_cpu(ctrl_ctx->add_flags)) - 1; /* A usb_set_interface() call directly after clearing a halted |