• Lu Baolu's avatar
    usb: xhci: fix possible wild pointer · 2b985467
    Lu Baolu authored
    handle_cmd_completion() frees a command structure which might be still
    referenced by xhci->current_cmd.
    This might cause problem when xhci->current_cmd is accessed after that.
    
    A real-life case could be like this. The host takes a very long time to
    respond to a command, and the command timer is fired at the same time
    when the command completion event arrives. The command completion
    handler frees xhci->current_cmd before the timer function can grab
    xhci->lock. Afterward, timer function grabs the lock and go ahead with
    checking and setting members of xhci->current_cmd.
    
    Cc: <stable@vger.kernel.org> # v3.16+
    Signed-off-by: default avatarLu Baolu <baolu.lu@linux.intel.com>
    Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    2b985467
xhci-ring.c 121 KB