aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBaolin Wang <baolin.wang@linaro.org>2017-01-03 11:28:47 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-01-03 11:37:32 -0500
commit2a7cfdf37b7c08ac29df4c62ea5ccb01474b6597 (patch)
treeb12c8a58d6a894f1fb8f2560c13abb26b1826489
parent2b985467371a58ae44d76c7ba12b0951fee6ed98 (diff)
usb: host: xhci: Fix possible wild pointer when handling abort command
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. Cc: <stable@vger.kernel.org> Signed-off-by: Baolin Wang <baolin.wang@linaro.org> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/host/xhci-ring.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index acc37311c938..bc8be6f6669e 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -1363,8 +1363,11 @@ static void handle_cmd_completion(struct xhci_hcd *xhci,
1363 */ 1363 */
1364 if (cmd_comp_code == COMP_CMD_ABORT) { 1364 if (cmd_comp_code == COMP_CMD_ABORT) {
1365 xhci->cmd_ring_state = CMD_RING_STATE_STOPPED; 1365 xhci->cmd_ring_state = CMD_RING_STATE_STOPPED;
1366 if (cmd->status == COMP_CMD_ABORT) 1366 if (cmd->status == COMP_CMD_ABORT) {
1367 if (xhci->current_cmd == cmd)
1368 xhci->current_cmd = NULL;
1367 goto event_handled; 1369 goto event_handled;
1370 }
1368 } 1371 }
1369 1372
1370 cmd_type = TRB_FIELD_TO_TYPE(le32_to_cpu(cmd_trb->generic.field[3])); 1373 cmd_type = TRB_FIELD_TO_TYPE(le32_to_cpu(cmd_trb->generic.field[3]));