]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.13.6/usb-xhci-free-the-right-ring-in-xhci_add_endpoint.patch
fixes for 4.19
[thirdparty/kernel/stable-queue.git] / releases / 4.13.6 / usb-xhci-free-the-right-ring-in-xhci_add_endpoint.patch
CommitLineData
b0bd2087
GKH
1From 9821786d7c90eee2f6852261893d9703801aae47 Mon Sep 17 00:00:00 2001
2From: Lu Baolu <baolu.lu@linux.intel.com>
3Date: Mon, 18 Sep 2017 17:39:12 +0300
4Subject: usb: xhci: Free the right ring in xhci_add_endpoint()
5
6From: Lu Baolu <baolu.lu@linux.intel.com>
7
8commit 9821786d7c90eee2f6852261893d9703801aae47 upstream.
9
10In the xhci_add_endpoint(), a new ring was allocated and saved at
11xhci_virt_ep->new_ring. Hence, when error happens, we need to free
12the allocated ring before returning error.
13
14Current code frees xhci_virt_ep->ring instead of the new_ring. This
15patch fixes this.
16
17Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
18Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
19Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20
21---
22 drivers/usb/host/xhci.c | 3 ++-
23 1 file changed, 2 insertions(+), 1 deletion(-)
24
25--- a/drivers/usb/host/xhci.c
26+++ b/drivers/usb/host/xhci.c
27@@ -1703,7 +1703,8 @@ static int xhci_add_endpoint(struct usb_
28 if (xhci->quirks & XHCI_MTK_HOST) {
29 ret = xhci_mtk_add_ep_quirk(hcd, udev, ep);
30 if (ret < 0) {
31- xhci_free_endpoint_ring(xhci, virt_dev, ep_index);
32+ xhci_ring_free(xhci, virt_dev->eps[ep_index].new_ring);
33+ virt_dev->eps[ep_index].new_ring = NULL;
34 return ret;
35 }
36 }