From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org,
Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>,
Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>,
Felipe Balbi <felipe.balbi@linux.intel.com>
Subject: [PATCH 4.9 27/41] usb: gadget: udc: renesas_usb3: Fix usb_gadget_giveback_request() calling
Date: Mon, 14 Aug 2017 18:18:37 -0700 [thread overview]
Message-ID: <20170815011810.059420499@linuxfoundation.org> (raw)
In-Reply-To: <20170815011808.667221255@linuxfoundation.org>
4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
commit aca5b9ebd096039657417c321a9252c696b359c2 upstream.
According to the gadget.h, a "complete" function will always be called
with interrupts disabled. However, sometimes usb3_request_done() function
is called with interrupts enabled. So, this function should be held
by spin_lock_irqsave() to disable interruption. Also, this driver has
to call spin_unlock() to avoid spinlock recursion by this driver before
calling usb_gadget_giveback_request().
Reported-by: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
Tested-by: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
Fixes: 746bfe63bba3 ("usb: gadget: renesas_usb3: add support for Renesas USB3.0 peripheral controller")
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/usb/gadget/udc/renesas_usb3.c | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
--- a/drivers/usb/gadget/udc/renesas_usb3.c
+++ b/drivers/usb/gadget/udc/renesas_usb3.c
@@ -685,21 +685,32 @@ static struct renesas_usb3_request *usb3
return usb3_req;
}
-static void usb3_request_done(struct renesas_usb3_ep *usb3_ep,
- struct renesas_usb3_request *usb3_req, int status)
+static void __usb3_request_done(struct renesas_usb3_ep *usb3_ep,
+ struct renesas_usb3_request *usb3_req,
+ int status)
{
struct renesas_usb3 *usb3 = usb3_ep_to_usb3(usb3_ep);
- unsigned long flags;
dev_dbg(usb3_to_dev(usb3), "giveback: ep%2d, %u, %u, %d\n",
usb3_ep->num, usb3_req->req.length, usb3_req->req.actual,
status);
usb3_req->req.status = status;
- spin_lock_irqsave(&usb3->lock, flags);
usb3_ep->started = false;
list_del_init(&usb3_req->queue);
- spin_unlock_irqrestore(&usb3->lock, flags);
+ spin_unlock(&usb3->lock);
usb_gadget_giveback_request(&usb3_ep->ep, &usb3_req->req);
+ spin_lock(&usb3->lock);
+}
+
+static void usb3_request_done(struct renesas_usb3_ep *usb3_ep,
+ struct renesas_usb3_request *usb3_req, int status)
+{
+ struct renesas_usb3 *usb3 = usb3_ep_to_usb3(usb3_ep);
+ unsigned long flags;
+
+ spin_lock_irqsave(&usb3->lock, flags);
+ __usb3_request_done(usb3_ep, usb3_req, status);
+ spin_unlock_irqrestore(&usb3->lock, flags);
}
static void usb3_irq_epc_pipe0_status_end(struct renesas_usb3 *usb3)
next prev parent reply other threads:[~2017-08-15 1:18 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-15 1:18 [PATCH 4.9 00/41] 4.9.44-stable review Greg Kroah-Hartman
2017-08-15 1:18 ` [PATCH 4.9 01/41] mm: ratelimit PFNs busy info message Greg Kroah-Hartman
2017-08-15 1:18 ` [PATCH 4.9 02/41] mm: fix list corruptions on shmem shrinklist Greg Kroah-Hartman
2017-08-15 1:18 ` [PATCH 4.9 03/41] futex: Remove unnecessary warning from get_futex_key Greg Kroah-Hartman
2017-08-15 1:18 ` [PATCH 4.9 04/41] xtensa: fix cache aliasing handling code for WT cache Greg Kroah-Hartman
2017-08-15 1:18 ` [PATCH 4.9 05/41] xtensa: mm/cache: add missing EXPORT_SYMBOLs Greg Kroah-Hartman
2017-08-15 1:18 ` [PATCH 4.9 06/41] xtensa: dont limit csum_partial export by CONFIG_NET Greg Kroah-Hartman
2017-08-15 1:18 ` [PATCH 4.9 07/41] mtd: nand: Fix timing setup for NANDs that do not support SET FEATURES Greg Kroah-Hartman
2017-08-15 1:18 ` [PATCH 4.9 08/41] iscsi-target: fix memory leak in iscsit_setup_text_cmd() Greg Kroah-Hartman
2017-08-15 1:18 ` [PATCH 4.9 09/41] iscsi-target: Fix iscsi_np reset hung task during parallel delete Greg Kroah-Hartman
2017-08-15 1:18 ` [PATCH 4.9 10/41] target: Fix node_acl demo-mode + uncached dynamic shutdown regression Greg Kroah-Hartman
2017-08-15 1:18 ` [PATCH 4.9 11/41] fuse: initialize the flock flag in fuse_file on allocation Greg Kroah-Hartman
2017-08-15 1:18 ` [PATCH 4.9 12/41] nand: fix wrong default oob layout for small pages using soft ecc Greg Kroah-Hartman
2017-08-15 1:18 ` [PATCH 4.9 13/41] mmc: mmc: correct the logic for setting HS400ES signal voltage Greg Kroah-Hartman
2017-08-15 1:18 ` [PATCH 4.9 14/41] nfs/flexfiles: fix leak of nfs4_ff_ds_version arrays Greg Kroah-Hartman
2017-08-15 1:18 ` [PATCH 4.9 15/41] drm/etnaviv: Fix off-by-one error in reloc checking Greg Kroah-Hartman
2017-08-15 1:18 ` [PATCH 4.9 16/41] drm/i915: Fix out-of-bounds array access in bdw_load_gamma_lut Greg Kroah-Hartman
2017-08-15 1:18 ` [PATCH 4.9 17/41] USB: serial: option: add D-Link DWM-222 device ID Greg Kroah-Hartman
2017-08-15 1:18 ` [PATCH 4.9 18/41] USB: serial: cp210x: add support for Qivicon USB ZigBee dongle Greg Kroah-Hartman
2017-08-15 1:18 ` [PATCH 4.9 19/41] USB: serial: pl2303: add new ATEN device id Greg Kroah-Hartman
2017-08-15 1:18 ` [PATCH 4.9 20/41] usb: musb: fix tx fifo flush handling again Greg Kroah-Hartman
2017-08-15 1:18 ` [PATCH 4.9 21/41] USB: hcd: Mark secondary HCD as dead if the primary one died Greg Kroah-Hartman
2017-08-15 1:18 ` [PATCH 4.9 22/41] staging:iio:resolver:ad2s1210 fix negative IIO_ANGL_VEL read Greg Kroah-Hartman
2017-08-15 1:18 ` [PATCH 4.9 23/41] iio: accel: bmc150: Always restore device to normal mode after suspend-resume Greg Kroah-Hartman
2017-08-15 1:18 ` [PATCH 4.9 24/41] iio: light: tsl2563: use correct event code Greg Kroah-Hartman
2017-08-15 1:18 ` [PATCH 4.9 25/41] staging: comedi: comedi_fops: do not call blocking ops when !TASK_RUNNING Greg Kroah-Hartman
2017-08-15 1:18 ` [PATCH 4.9 26/41] uas: Add US_FL_IGNORE_RESIDUE for Initio Corporation INIC-3069 Greg Kroah-Hartman
2017-08-15 1:18 ` Greg Kroah-Hartman [this message]
2017-08-15 1:18 ` [PATCH 4.9 28/41] usb: renesas_usbhs: Fix UGCTRL2 value for R-Car Gen3 Greg Kroah-Hartman
2017-08-15 1:18 ` [PATCH 4.9 29/41] USB: Check for dropped connection before switching to full speed Greg Kroah-Hartman
2017-08-15 1:18 ` [PATCH 4.9 30/41] usb: core: unlink urbs from the tail of the endpoints urb_list Greg Kroah-Hartman
2017-08-15 1:18 ` [PATCH 4.9 31/41] usb: quirks: Add no-lpm quirk for Moshi USB to Ethernet Adapter Greg Kroah-Hartman
2017-08-15 1:18 ` [PATCH 4.9 32/41] usb:xhci:Add quirk for Certain failing HP keyboard on reset after resume Greg Kroah-Hartman
2017-08-15 1:18 ` [PATCH 4.9 33/41] iio: adc: vf610_adc: Fix VALT selection value for REFSEL bits Greg Kroah-Hartman
2017-08-15 1:18 ` [PATCH 4.9 34/41] pnfs/blocklayout: require 64-bit sector_t Greg Kroah-Hartman
2017-08-15 1:18 ` [PATCH 4.9 35/41] pinctrl: sunxi: add a missing function of A10/A20 pinctrl driver Greg Kroah-Hartman
2017-08-15 1:18 ` [PATCH 4.9 36/41] pinctrl: intel: merrifield: Correct UART pin lists Greg Kroah-Hartman
2017-08-15 1:18 ` [PATCH 4.9 37/41] pinctrl: uniphier: fix WARN_ON() of pingroups dump on LD11 Greg Kroah-Hartman
2017-08-15 1:18 ` [PATCH 4.9 38/41] pinctrl: uniphier: fix WARN_ON() of pingroups dump on LD20 Greg Kroah-Hartman
2017-08-15 1:18 ` [PATCH 4.9 39/41] pinctrl: samsung: Remove bogus irq_[un]mask from resource management Greg Kroah-Hartman
2017-08-15 1:18 ` [PATCH 4.9 40/41] pinctrl: meson-gxbb: Add missing GPIODV_18 pin entry Greg Kroah-Hartman
2017-08-15 1:18 ` [PATCH 4.9 41/41] MIPS: DEC: Fix an int-handler.S CPU_DADDI_WORKAROUNDS regression Greg Kroah-Hartman
2017-08-15 10:43 ` [PATCH 4.9 00/41] 4.9.44-stable review Guenter Roeck
2017-08-15 18:07 ` Shuah Khan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170815011810.059420499@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=felipe.balbi@linux.intel.com \
--cc=kazuya.mizuguchi.ks@renesas.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=yoshihiro.shimoda.uh@renesas.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).