diff options
author | Lu Baolu <baolu.lu@linux.intel.com> | 2017-09-18 17:39:12 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-10-12 12:56:10 +0300 |
commit | 7282898c6eeff27b9298bc36ff10fd9ca2a931ea (patch) | |
tree | 94d5ca4ac897c8b99652dd9ea390e41269ac52dd | |
parent | 31991559f483b33eb30b7fdb1219b3f78b616a27 (diff) | |
download | linux-7282898c6eeff27b9298bc36ff10fd9ca2a931ea.tar.xz |
usb: xhci: Free the right ring in xhci_add_endpoint()
commit 9821786d7c90eee2f6852261893d9703801aae47 upstream.
In the xhci_add_endpoint(), a new ring was allocated and saved at
xhci_virt_ep->new_ring. Hence, when error happens, we need to free
the allocated ring before returning error.
Current code frees xhci_virt_ep->ring instead of the new_ring. This
patch fixes this.
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
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.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index b2ff1ff1a02f..ee198ea47f49 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -1703,7 +1703,8 @@ static int xhci_add_endpoint(struct usb_hcd *hcd, struct usb_device *udev, if (xhci->quirks & XHCI_MTK_HOST) { ret = xhci_mtk_add_ep_quirk(hcd, udev, ep); if (ret < 0) { - xhci_free_endpoint_ring(xhci, virt_dev, ep_index); + xhci_ring_free(xhci, virt_dev->eps[ep_index].new_ring); + virt_dev->eps[ep_index].new_ring = NULL; return ret; } } |