Commit 0de9e0aa authored by Baolin Wang's avatar Baolin Wang Committed by Ben Hutchings

usb: host: xhci: Fix possible wild pointer when handling abort command

commit 2a7cfdf3 upstream.

When current command was supposed to be aborted, host will free the command
in handle_cmd_completion() function. But it might be still referenced by
xhci->current_cmd, which need to set NULL.
Signed-off-by: default avatarBaolin Wang <baolin.wang@linaro.org>
Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 35477ad4
...@@ -1380,8 +1380,11 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, ...@@ -1380,8 +1380,11 @@ static void handle_cmd_completion(struct xhci_hcd *xhci,
*/ */
if (cmd_comp_code == COMP_CMD_ABORT) { if (cmd_comp_code == COMP_CMD_ABORT) {
xhci->cmd_ring_state = CMD_RING_STATE_STOPPED; xhci->cmd_ring_state = CMD_RING_STATE_STOPPED;
if (cmd->status == COMP_CMD_ABORT) if (cmd->status == COMP_CMD_ABORT) {
if (xhci->current_cmd == cmd)
xhci->current_cmd = NULL;
goto event_handled; goto event_handled;
}
} }
cmd_type = TRB_FIELD_TO_TYPE(le32_to_cpu(cmd_trb->generic.field[3])); cmd_type = TRB_FIELD_TO_TYPE(le32_to_cpu(cmd_trb->generic.field[3]));
......
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