From: Zheng Xiaowei Date: Fri, 20 Jul 2018 15:05:11 +0000 (+0300) Subject: usb: xhci: Fix memory leak in xhci_endpoint_reset() X-Git-Tag: v4.17.11~15 X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ab7e6f96127ec1e6dd218441b914fa99891cea9c;p=linux usb: xhci: Fix memory leak in xhci_endpoint_reset() commit d89b7664f76047e7beca8f07e86f2ccfad085a28 upstream. If td_list is not empty the cfg_cmd will not be freed, call xhci_free_command to free it. Signed-off-by: Zheng Xiaowei Cc: Signed-off-by: Mathias Nyman Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 61c3dc2f3be5..5fb4319d7fd1 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -2981,6 +2981,7 @@ static void xhci_endpoint_reset(struct usb_hcd *hcd, if (!list_empty(&ep->ring->td_list)) { dev_err(&udev->dev, "EP not empty, refuse reset\n"); spin_unlock_irqrestore(&xhci->lock, flags); + xhci_free_command(xhci, cfg_cmd); goto cleanup; } xhci_queue_stop_endpoint(xhci, stop_cmd, udev->slot_id, ep_index, 0);