]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
3.14-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 Jul 2015 01:49:46 +0000 (18:49 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 Jul 2015 01:49:46 +0000 (18:49 -0700)
added patches:
usb-cp210x-add-id-for-aruba-networks-controllers.patch
usb-devio-fix-a-condition-in-async_completed.patch
usb-dwc3-gadget-return-error-if-command-sent-to-depcmd-register-fails.patch
usb-dwc3-gadget-return-error-if-command-sent-to-dgcmd-register-fails.patch
usb-dwc3-reset-the-transfer-resource-index-on-set_interface.patch
usb-musb-host-rely-on-port_mode-to-call-musb_start.patch
usb-option-add-2020-4000-id.patch
usb-serial-destroy-serial_minors-idr-on-module-exit.patch
usb-xhci-bugfix-for-null-pointer-deference-in-xhci_endpoint_init-function.patch

queue-3.14/series
queue-3.14/usb-cp210x-add-id-for-aruba-networks-controllers.patch [new file with mode: 0644]
queue-3.14/usb-devio-fix-a-condition-in-async_completed.patch [new file with mode: 0644]
queue-3.14/usb-dwc3-gadget-return-error-if-command-sent-to-depcmd-register-fails.patch [new file with mode: 0644]
queue-3.14/usb-dwc3-gadget-return-error-if-command-sent-to-dgcmd-register-fails.patch [new file with mode: 0644]
queue-3.14/usb-dwc3-reset-the-transfer-resource-index-on-set_interface.patch [new file with mode: 0644]
queue-3.14/usb-musb-host-rely-on-port_mode-to-call-musb_start.patch [new file with mode: 0644]
queue-3.14/usb-option-add-2020-4000-id.patch [new file with mode: 0644]
queue-3.14/usb-serial-destroy-serial_minors-idr-on-module-exit.patch [new file with mode: 0644]
queue-3.14/usb-xhci-bugfix-for-null-pointer-deference-in-xhci_endpoint_init-function.patch [new file with mode: 0644]

index 9605304c46fa329ca7a9405fd8a69b0edcf0b417..d07fa22e420635ba928ff38c5c323173958aee76 100644 (file)
@@ -56,3 +56,12 @@ asoc-wm8903-fix-define-for-wm8903_vmid_res_250k.patch
 asoc-wm8960-the-enum-of-dac-polarity-should-be-wm8960_enum.patch
 libata-add-ata_horkage_broken_fpdma_aa-quirk-for-hp-250gb-sata-disk-vb0250eaver.patch
 libata-increase-the-timeout-when-setting-transfer-mode.patch
+usb-dwc3-gadget-return-error-if-command-sent-to-dgcmd-register-fails.patch
+usb-dwc3-gadget-return-error-if-command-sent-to-depcmd-register-fails.patch
+usb-dwc3-reset-the-transfer-resource-index-on-set_interface.patch
+usb-devio-fix-a-condition-in-async_completed.patch
+usb-musb-host-rely-on-port_mode-to-call-musb_start.patch
+usb-cp210x-add-id-for-aruba-networks-controllers.patch
+usb-option-add-2020-4000-id.patch
+usb-serial-destroy-serial_minors-idr-on-module-exit.patch
+usb-xhci-bugfix-for-null-pointer-deference-in-xhci_endpoint_init-function.patch
diff --git a/queue-3.14/usb-cp210x-add-id-for-aruba-networks-controllers.patch b/queue-3.14/usb-cp210x-add-id-for-aruba-networks-controllers.patch
new file mode 100644 (file)
index 0000000..9de14ee
--- /dev/null
@@ -0,0 +1,30 @@
+From f98a7aa81eeeadcad25665c3501c236d531d4382 Mon Sep 17 00:00:00 2001
+From: Peter Sanford <peter@sanford.io>
+Date: Thu, 25 Jun 2015 17:40:05 -0700
+Subject: USB: cp210x: add ID for Aruba Networks controllers
+
+From: Peter Sanford <peter@sanford.io>
+
+commit f98a7aa81eeeadcad25665c3501c236d531d4382 upstream.
+
+Add the USB serial console device ID for Aruba Networks 7xxx series
+controllers which have a USB port for their serial console.
+
+Signed-off-by: Peter Sanford <peter@sanford.io>
+Signed-off-by: Johan Hovold <johan@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/serial/cp210x.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/usb/serial/cp210x.c
++++ b/drivers/usb/serial/cp210x.c
+@@ -187,6 +187,7 @@ static const struct usb_device_id id_tab
+       { USB_DEVICE(0x1FB9, 0x0602) }, /* Lake Shore Model 648 Magnet Power Supply */
+       { USB_DEVICE(0x1FB9, 0x0700) }, /* Lake Shore Model 737 VSM Controller */
+       { USB_DEVICE(0x1FB9, 0x0701) }, /* Lake Shore Model 776 Hall Matrix */
++      { USB_DEVICE(0x2626, 0xEA60) }, /* Aruba Networks 7xxx USB Serial Console */
+       { USB_DEVICE(0x3195, 0xF190) }, /* Link Instruments MSO-19 */
+       { USB_DEVICE(0x3195, 0xF280) }, /* Link Instruments MSO-28 */
+       { USB_DEVICE(0x3195, 0xF281) }, /* Link Instruments MSO-28 */
diff --git a/queue-3.14/usb-devio-fix-a-condition-in-async_completed.patch b/queue-3.14/usb-devio-fix-a-condition-in-async_completed.patch
new file mode 100644 (file)
index 0000000..94dcca7
--- /dev/null
@@ -0,0 +1,33 @@
+From 83ed07c5db71bc02bd646d6eb60b48908235cdf9 Mon Sep 17 00:00:00 2001
+From: Dan Carpenter <dan.carpenter@oracle.com>
+Date: Mon, 18 May 2015 15:29:51 +0300
+Subject: USB: devio: fix a condition in async_completed()
+
+From: Dan Carpenter <dan.carpenter@oracle.com>
+
+commit 83ed07c5db71bc02bd646d6eb60b48908235cdf9 upstream.
+
+Static checkers complain that the current condition is never true.  It
+seems pretty likely that it's a typo and "URB" was intended instead of
+"USB".
+
+Fixes: 3d97ff63f899 ('usbdevfs: Use scatter-gather lists for large bulk transfers')
+Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
+Acked-by: Alan Stern <stern@rowland.harvard.edu>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/core/devio.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/usb/core/devio.c
++++ b/drivers/usb/core/devio.c
+@@ -513,7 +513,7 @@ static void async_completed(struct urb *
+       snoop(&urb->dev->dev, "urb complete\n");
+       snoop_urb(urb->dev, as->userurb, urb->pipe, urb->actual_length,
+                       as->status, COMPLETE, NULL, 0);
+-      if ((urb->transfer_flags & URB_DIR_MASK) == USB_DIR_IN)
++      if ((urb->transfer_flags & URB_DIR_MASK) == URB_DIR_IN)
+               snoop_urb_data(urb, urb->actual_length);
+       if (as->status < 0 && as->bulk_addr && as->status != -ECONNRESET &&
diff --git a/queue-3.14/usb-dwc3-gadget-return-error-if-command-sent-to-depcmd-register-fails.patch b/queue-3.14/usb-dwc3-gadget-return-error-if-command-sent-to-depcmd-register-fails.patch
new file mode 100644 (file)
index 0000000..3a3b23d
--- /dev/null
@@ -0,0 +1,32 @@
+From 76e838c9f7765f9a6205b4d558d75a66104bc60d Mon Sep 17 00:00:00 2001
+From: Subbaraya Sundeep Bhatta <subbaraya.sundeep.bhatta@xilinx.com>
+Date: Thu, 21 May 2015 15:46:48 +0530
+Subject: usb: dwc3: gadget: return error if command sent to DEPCMD register fails
+
+From: Subbaraya Sundeep Bhatta <subbaraya.sundeep.bhatta@xilinx.com>
+
+commit 76e838c9f7765f9a6205b4d558d75a66104bc60d upstream.
+
+We need to return error to caller if command is not sent to
+controller succesfully.
+
+Signed-off-by: Subbaraya Sundeep Bhatta <sbhatta@xilinx.com>
+Fixes: 72246da40f37 (usb: Introduce DesignWare USB3 DRD Driver)
+Signed-off-by: Felipe Balbi <balbi@ti.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/dwc3/gadget.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/usb/dwc3/gadget.c
++++ b/drivers/usb/dwc3/gadget.c
+@@ -337,6 +337,8 @@ int dwc3_send_gadget_ep_cmd(struct dwc3
+               if (!(reg & DWC3_DEPCMD_CMDACT)) {
+                       dev_vdbg(dwc->dev, "Command Complete --> %d\n",
+                                       DWC3_DEPCMD_STATUS(reg));
++                      if (DWC3_DEPCMD_STATUS(reg))
++                              return -EINVAL;
+                       return 0;
+               }
diff --git a/queue-3.14/usb-dwc3-gadget-return-error-if-command-sent-to-dgcmd-register-fails.patch b/queue-3.14/usb-dwc3-gadget-return-error-if-command-sent-to-dgcmd-register-fails.patch
new file mode 100644 (file)
index 0000000..a69ee56
--- /dev/null
@@ -0,0 +1,32 @@
+From 891b1dc022955d36cf4c0f42d383226a930db7ed Mon Sep 17 00:00:00 2001
+From: Subbaraya Sundeep Bhatta <subbaraya.sundeep.bhatta@xilinx.com>
+Date: Thu, 21 May 2015 15:46:47 +0530
+Subject: usb: dwc3: gadget: return error if command sent to DGCMD register fails
+
+From: Subbaraya Sundeep Bhatta <subbaraya.sundeep.bhatta@xilinx.com>
+
+commit 891b1dc022955d36cf4c0f42d383226a930db7ed upstream.
+
+We need to return error to caller if command is not sent to
+controller succesfully.
+
+Signed-off-by: Subbaraya Sundeep Bhatta <sbhatta@xilinx.com>
+Fixes: b09bb64239c8 (usb: dwc3: gadget: implement Global Command support)
+Signed-off-by: Felipe Balbi <balbi@ti.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/dwc3/gadget.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/usb/dwc3/gadget.c
++++ b/drivers/usb/dwc3/gadget.c
+@@ -299,6 +299,8 @@ int dwc3_send_gadget_generic_command(str
+               if (!(reg & DWC3_DGCMD_CMDACT)) {
+                       dev_vdbg(dwc->dev, "Command Complete --> %d\n",
+                                       DWC3_DGCMD_STATUS(reg));
++                      if (DWC3_DGCMD_STATUS(reg))
++                              return -EINVAL;
+                       return 0;
+               }
diff --git a/queue-3.14/usb-dwc3-reset-the-transfer-resource-index-on-set_interface.patch b/queue-3.14/usb-dwc3-reset-the-transfer-resource-index-on-set_interface.patch
new file mode 100644 (file)
index 0000000..40f081f
--- /dev/null
@@ -0,0 +1,56 @@
+From aebda618718157a69c0dc0adb978d69bc2b8723c Mon Sep 17 00:00:00 2001
+From: John Youn <John.Youn@synopsys.com>
+Date: Mon, 17 Sep 2001 00:00:00 -0700
+Subject: usb: dwc3: Reset the transfer resource index on SET_INTERFACE
+
+From: John Youn <John.Youn@synopsys.com>
+
+commit aebda618718157a69c0dc0adb978d69bc2b8723c upstream.
+
+This fixes an issue introduced in commit b23c843992b6 (usb: dwc3:
+gadget: fix DEPSTARTCFG for non-EP0 EPs) that made sure we would
+only use DEPSTARTCFG once per SetConfig.
+
+The trick is that we should use one DEPSTARTCFG per SetConfig *OR*
+SetInterface. SetInterface was completely missed from the original
+patch.
+
+This problem became aparent after commit 76e838c9f776 (usb: dwc3:
+gadget: return error if command sent to DEPCMD register fails)
+added checking of the return status of device endpoint commands.
+
+'Set Endpoint Transfer Resource' command was caught failing
+occasionally. This is because the Transfer Resource
+Index was not getting reset during a SET_INTERFACE request.
+
+Finally, to fix the issue, was we have to do is make sure that
+our start_config_issued flag gets reset whenever we receive a
+SetInterface request.
+
+To verify the problem (and its fix), all we have to do is run
+test 9 from testusb with 'testusb -t 9 -s 2048 -a -c 5000'.
+
+Tested-by: Huang Rui <ray.huang@amd.com>
+Tested-by: Subbaraya Sundeep Bhatta <subbaraya.sundeep.bhatta@xilinx.com>
+Fixes: b23c843992b6 (usb: dwc3: gadget: fix DEPSTARTCFG for non-EP0 EPs)
+Signed-off-by: John Youn <johnyoun@synopsys.com>
+Signed-off-by: Felipe Balbi <balbi@ti.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/dwc3/ep0.c |    4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/drivers/usb/dwc3/ep0.c
++++ b/drivers/usb/dwc3/ep0.c
+@@ -707,6 +707,10 @@ static int dwc3_ep0_std_request(struct d
+               dev_vdbg(dwc->dev, "USB_REQ_SET_ISOCH_DELAY\n");
+               ret = dwc3_ep0_set_isoch_delay(dwc, ctrl);
+               break;
++      case USB_REQ_SET_INTERFACE:
++              dwc3_trace(trace_dwc3_ep0, "USB_REQ_SET_INTERFACE");
++              dwc->start_config_issued = false;
++              /* Fall through */
+       default:
+               dev_vdbg(dwc->dev, "Forwarding to gadget driver\n");
+               ret = dwc3_ep0_delegate_req(dwc, ctrl);
diff --git a/queue-3.14/usb-musb-host-rely-on-port_mode-to-call-musb_start.patch b/queue-3.14/usb-musb-host-rely-on-port_mode-to-call-musb_start.patch
new file mode 100644 (file)
index 0000000..3d487cb
--- /dev/null
@@ -0,0 +1,41 @@
+From be9d39881fc4fa39a64b6eed6bab5d9ee5125344 Mon Sep 17 00:00:00 2001
+From: Felipe Balbi <balbi@ti.com>
+Date: Tue, 2 Jun 2015 13:03:36 -0500
+Subject: usb: musb: host: rely on port_mode to call musb_start()
+
+From: Felipe Balbi <balbi@ti.com>
+
+commit be9d39881fc4fa39a64b6eed6bab5d9ee5125344 upstream.
+
+Currently, we're calling musb_start() twice for DRD ports
+in some situations. This has been observed to cause enumeration
+issues after suspend/resume cycles with AM335x.
+
+In order to fix the problem, we just have to fix the check
+on musb_has_gadget() so that it only returns true if
+current mode is Host and ignore the fact that we have or
+not a gadget driver loaded.
+
+Fixes: ae44df2e21b5 (usb: musb: call musb_start() only once in OTG mode)
+Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+Tested-by: Sekhar Nori <nsekhar@ti.com>
+Signed-off-by: Felipe Balbi <balbi@ti.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/musb/musb_virthub.c |    4 +---
+ 1 file changed, 1 insertion(+), 3 deletions(-)
+
+--- a/drivers/usb/musb/musb_virthub.c
++++ b/drivers/usb/musb/musb_virthub.c
+@@ -273,9 +273,7 @@ static int musb_has_gadget(struct musb *
+ #ifdef CONFIG_USB_MUSB_HOST
+       return 1;
+ #else
+-      if (musb->port_mode == MUSB_PORT_MODE_HOST)
+-              return 1;
+-      return musb->g.dev.driver != NULL;
++      return musb->port_mode == MUSB_PORT_MODE_HOST;
+ #endif
+ }
diff --git a/queue-3.14/usb-option-add-2020-4000-id.patch b/queue-3.14/usb-option-add-2020-4000-id.patch
new file mode 100644 (file)
index 0000000..c60b54f
--- /dev/null
@@ -0,0 +1,45 @@
+From f6d7fb37f92622479ef6da604f27561f5045ba1e Mon Sep 17 00:00:00 2001
+From: Claudio Cappelli <claudio.cappelli.linux@gmail.com>
+Date: Wed, 10 Jun 2015 20:38:30 +0200
+Subject: USB: option: add 2020:4000 ID
+
+From: Claudio Cappelli <claudio.cappelli.linux@gmail.com>
+
+commit f6d7fb37f92622479ef6da604f27561f5045ba1e upstream.
+
+Add device Olivetti Olicard 300 (Network Connect: MT6225) - IDs 2020:4000.
+
+T:  Bus=01 Lev=02 Prnt=04 Port=00 Cnt=01 Dev#= 10 Spd=480 MxCh= 0
+D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
+P:  Vendor=2020 ProdID=4000 Rev=03.00
+S:  Manufacturer=Network Connect
+S:  Product=MT6225
+C:  #Ifs= 7 Cfg#= 1 Atr=a0 MxPwr=500mA
+I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
+I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
+I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=02 Prot=01 Driver=option
+I:  If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
+I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
+I:  If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
+I:  If#= 6 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
+
+Signed-off-by: Claudio Cappelli <claudio.cappelli.linux@gmail.com>
+Suggested-by: Lars Melin <larsm17@gmail.com>
+[johan: amend commit message with devices info ]
+Signed-off-by: Johan Hovold <johan@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/serial/option.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/usb/serial/option.c
++++ b/drivers/usb/serial/option.c
+@@ -1755,6 +1755,7 @@ static const struct usb_device_id option
+       { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d03, 0xff, 0x00, 0x00) },
+       { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e01, 0xff, 0xff, 0xff) }, /* D-Link DWM-152/C1 */
+       { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e02, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/C1 */
++      { USB_DEVICE_INTERFACE_CLASS(0x2020, 0x4000, 0xff) },                /* OLICARD300 - MT6225 */
+       { USB_DEVICE(INOVIA_VENDOR_ID, INOVIA_SEW858) },
+       { USB_DEVICE(VIATELECOM_VENDOR_ID, VIATELECOM_PRODUCT_CDS7) },
+       { } /* Terminating entry */
diff --git a/queue-3.14/usb-serial-destroy-serial_minors-idr-on-module-exit.patch b/queue-3.14/usb-serial-destroy-serial_minors-idr-on-module-exit.patch
new file mode 100644 (file)
index 0000000..ee86b58
--- /dev/null
@@ -0,0 +1,75 @@
+From d23f47d4927fd2f61b3a754d83c7bcec215b5cfe Mon Sep 17 00:00:00 2001
+From: Johannes Thumshirn <jthumshirn@suse.de>
+Date: Wed, 8 Jul 2015 17:26:37 +0200
+Subject: USB: serial: Destroy serial_minors IDR on module exit
+
+From: Johannes Thumshirn <jthumshirn@suse.de>
+
+commit d23f47d4927fd2f61b3a754d83c7bcec215b5cfe upstream.
+
+Destroy serial_minors IDR on module exit, reclaiming the allocated memory.
+
+This was detected by the following semantic patch (written by Luis
+Rodriguez <mcgrof@suse.com>)
+
+<SmPL>
+@ defines_module_init @
+declarer name module_init, module_exit;
+declarer name DEFINE_IDR;
+identifier init;
+@@
+
+module_init(init);
+
+@ defines_module_exit @
+identifier exit;
+@@
+
+module_exit(exit);
+
+@ declares_idr depends on defines_module_init && defines_module_exit @
+identifier idr;
+@@
+
+DEFINE_IDR(idr);
+
+@ on_exit_calls_destroy depends on declares_idr && defines_module_exit @
+identifier declares_idr.idr, defines_module_exit.exit;
+@@
+
+exit(void)
+{
+ ...
+ idr_destroy(&idr);
+ ...
+}
+
+@ missing_module_idr_destroy depends on declares_idr && defines_module_exit && !on_exit_calls_destroy @
+identifier declares_idr.idr, defines_module_exit.exit;
+@@
+
+exit(void)
+{
+ ...
+ +idr_destroy(&idr);
+}
+</SmPL>
+
+Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
+Signed-off-by: Johan Hovold <johan@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/serial/usb-serial.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/usb/serial/usb-serial.c
++++ b/drivers/usb/serial/usb-serial.c
+@@ -1300,6 +1300,7 @@ static void __exit usb_serial_exit(void)
+       tty_unregister_driver(usb_serial_tty_driver);
+       put_tty_driver(usb_serial_tty_driver);
+       bus_unregister(&usb_serial_bus_type);
++      idr_destroy(&serial_minors);
+ }
diff --git a/queue-3.14/usb-xhci-bugfix-for-null-pointer-deference-in-xhci_endpoint_init-function.patch b/queue-3.14/usb-xhci-bugfix-for-null-pointer-deference-in-xhci_endpoint_init-function.patch
new file mode 100644 (file)
index 0000000..f7a7380
--- /dev/null
@@ -0,0 +1,57 @@
+From 3496810663922617d4b706ef2780c279252ddd6a Mon Sep 17 00:00:00 2001
+From: AMAN DEEP <aman.deep@samsung.com>
+Date: Tue, 21 Jul 2015 17:20:27 +0300
+Subject: usb: xhci: Bugfix for NULL pointer deference in xhci_endpoint_init() function
+
+From: AMAN DEEP <aman.deep@samsung.com>
+
+commit 3496810663922617d4b706ef2780c279252ddd6a upstream.
+
+virt_dev->num_cached_rings counts on freed ring and is not updated
+correctly. In xhci_free_or_cache_endpoint_ring() function, the free ring
+is added into cache and then num_rings_cache is incremented as below:
+               virt_dev->ring_cache[rings_cached] =
+                       virt_dev->eps[ep_index].ring;
+               virt_dev->num_rings_cached++;
+here, free ring pointer is added to a current index and then
+index is incremented.
+So current index always points to empty location in the ring cache.
+For getting available free ring, current index should be decremented
+first and then corresponding ring buffer value should be taken from ring
+cache.
+
+But In function xhci_endpoint_init(), the num_rings_cached index is
+accessed before decrement.
+               virt_dev->eps[ep_index].new_ring =
+                       virt_dev->ring_cache[virt_dev->num_rings_cached];
+               virt_dev->ring_cache[virt_dev->num_rings_cached] = NULL;
+               virt_dev->num_rings_cached--;
+This is bug in manipulating the index of ring cache.
+And it should be as below:
+               virt_dev->num_rings_cached--;
+               virt_dev->eps[ep_index].new_ring =
+                       virt_dev->ring_cache[virt_dev->num_rings_cached];
+               virt_dev->ring_cache[virt_dev->num_rings_cached] = NULL;
+
+Signed-off-by: Aman Deep <aman.deep@samsung.com>
+Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/host/xhci-mem.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/usb/host/xhci-mem.c
++++ b/drivers/usb/host/xhci-mem.c
+@@ -1331,10 +1331,10 @@ int xhci_endpoint_init(struct xhci_hcd *
+               /* Attempt to use the ring cache */
+               if (virt_dev->num_rings_cached == 0)
+                       return -ENOMEM;
++              virt_dev->num_rings_cached--;
+               virt_dev->eps[ep_index].new_ring =
+                       virt_dev->ring_cache[virt_dev->num_rings_cached];
+               virt_dev->ring_cache[virt_dev->num_rings_cached] = NULL;
+-              virt_dev->num_rings_cached--;
+               xhci_reinit_cached_ring(xhci, virt_dev->eps[ep_index].new_ring,
+                                       1, type);
+       }