]>
Commit | Line | Data |
---|---|---|
b0bd2087 GKH |
1 | From 9821786d7c90eee2f6852261893d9703801aae47 Mon Sep 17 00:00:00 2001 |
2 | From: Lu Baolu <baolu.lu@linux.intel.com> | |
3 | Date: Mon, 18 Sep 2017 17:39:12 +0300 | |
4 | Subject: usb: xhci: Free the right ring in xhci_add_endpoint() | |
5 | ||
6 | From: Lu Baolu <baolu.lu@linux.intel.com> | |
7 | ||
8 | commit 9821786d7c90eee2f6852261893d9703801aae47 upstream. | |
9 | ||
10 | In the xhci_add_endpoint(), a new ring was allocated and saved at | |
11 | xhci_virt_ep->new_ring. Hence, when error happens, we need to free | |
12 | the allocated ring before returning error. | |
13 | ||
14 | Current code frees xhci_virt_ep->ring instead of the new_ring. This | |
15 | patch fixes this. | |
16 | ||
17 | Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> | |
18 | Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> | |
19 | Signed-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 | } |