mirror of
https://github.com/hardkernel/linux.git
synced 2026-03-26 12:30:23 +09:00
FROMGIT: xhci: check control context is valid before dereferencing it.
Don't dereference ctrl_ctx before checking it's valid.
Issue reported by Klockwork
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20210406070208.3406266-3-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 597899d2f7
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ic61b77fe25d05aa0bcacf6806cfbb13de861bedc
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
a201b4369c
commit
d535e4b2ca
@@ -3159,6 +3159,14 @@ static void xhci_endpoint_reset(struct usb_hcd *hcd,
|
||||
|
||||
/* config ep command clears toggle if add and drop ep flags are set */
|
||||
ctrl_ctx = xhci_get_input_control_ctx(cfg_cmd->in_ctx);
|
||||
if (!ctrl_ctx) {
|
||||
spin_unlock_irqrestore(&xhci->lock, flags);
|
||||
xhci_free_command(xhci, cfg_cmd);
|
||||
xhci_warn(xhci, "%s: Could not get input context, bad type.\n",
|
||||
__func__);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
xhci_setup_input_ctx_for_config_ep(xhci, cfg_cmd->in_ctx, vdev->out_ctx,
|
||||
ctrl_ctx, ep_flag, ep_flag);
|
||||
xhci_endpoint_copy(xhci, cfg_cmd->in_ctx, vdev->out_ctx, ep_index);
|
||||
|
||||
Reference in New Issue
Block a user