Commit 6fcfb0d6 authored by Mathias Nyman's avatar Mathias Nyman Committed by Greg Kroah-Hartman

xhci: Use correct SLOT ID when handling a reset device command

Command completion events normally include command completion status,
SLOT_ID, and a pointer to the original command. Reset device command
completion SLOT_ID may be zero according to xhci specs 4.6.11.

VIA controllers set the SLOT_ID to zero, triggering a WARN_ON in the
command completion handler.

Use the SLOT ID found from the original command instead.

This patch should be applied to stable kernels since 3.13 that contain
the commit 20e7acb1
"xhci: use completion event's slot id rather than dig it out of command"

Cc: stable@vger.kernel.org # 3.13
Reported-by: default avatarSaran Neti <sarannmr@gmail.com>
Tested-by: default avatarSaran Neti <sarannmr@gmail.com>
Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 135e7d0d
...@@ -1433,8 +1433,11 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, ...@@ -1433,8 +1433,11 @@ static void handle_cmd_completion(struct xhci_hcd *xhci,
xhci_handle_cmd_reset_ep(xhci, slot_id, cmd_trb, cmd_comp_code); xhci_handle_cmd_reset_ep(xhci, slot_id, cmd_trb, cmd_comp_code);
break; break;
case TRB_RESET_DEV: case TRB_RESET_DEV:
WARN_ON(slot_id != TRB_TO_SLOT_ID( /* SLOT_ID field in reset device cmd completion event TRB is 0.
le32_to_cpu(cmd_trb->generic.field[3]))); * Use the SLOT_ID from the command TRB instead (xhci 4.6.11)
*/
slot_id = TRB_TO_SLOT_ID(
le32_to_cpu(cmd_trb->generic.field[3]));
xhci_handle_cmd_reset_dev(xhci, slot_id, event); xhci_handle_cmd_reset_dev(xhci, slot_id, event);
break; break;
case TRB_NEC_GET_FW: case TRB_NEC_GET_FW:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment