lkml.org 
[lkml]   [2017]   [Mar]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Date
    Subject[PATCH 3.16 151/370] usb: host: xhci: Fix possible wild pointer when handling abort command
    3.16.42-rc1 review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Baolin Wang <baolin.wang@linaro.org>

    commit 2a7cfdf37b7c08ac29df4c62ea5ccb01474b6597 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: 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>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
    ---
    drivers/usb/host/xhci-ring.c | 5 ++++-
    1 file changed, 4 insertions(+), 1 deletion(-)

    --- a/drivers/usb/host/xhci-ring.c
    +++ b/drivers/usb/host/xhci-ring.c
    @@ -1380,8 +1380,11 @@ static void handle_cmd_completion(struct
    */
    if (cmd_comp_code == COMP_CMD_ABORT) {
    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;
    + }
    }

    cmd_type = TRB_FIELD_TO_TYPE(le32_to_cpu(cmd_trb->generic.field[3]));
    \
     
     \ /
      Last update: 2017-03-10 13:47    [W:4.088 / U:0.032 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site