summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMichal Nazarewicz <mina86@mina86.com>2016-10-04 02:07:33 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-11-21 10:11:38 +0100
commite2458382c792eb1be48ce3d604a37d1af9baa9f4 (patch)
treecce16719fb83b68f5d81e9191e6bf9f907f1a553 /drivers
parente34a0f1c53b5d412a57268397543d31db33e73fb (diff)
downloadlwn-e2458382c792eb1be48ce3d604a37d1af9baa9f4.tar.gz
lwn-e2458382c792eb1be48ce3d604a37d1af9baa9f4.zip
usb: gadget: f_fs: edit epfile->ep under lock
commit 454915dde06a51133750c6745f0ba57361ba209d upstream. epfile->ep is protected by ffs->eps_lock (not epfile->mutex) so clear it while holding the spin lock. Tested-by: John Stultz <john.stultz@linaro.org> Tested-by: Chen Yu <chenyu56@huawei.com> Signed-off-by: Michal Nazarewicz <mina86@mina86.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/gadget/function/f_fs.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
index 5c8429f23a89..c34abba7875f 100644
--- a/drivers/usb/gadget/function/f_fs.c
+++ b/drivers/usb/gadget/function/f_fs.c
@@ -1722,17 +1722,17 @@ static void ffs_func_eps_disable(struct ffs_function *func)
unsigned long flags;
do {
- if (epfile)
- mutex_lock(&epfile->mutex);
spin_lock_irqsave(&func->ffs->eps_lock, flags);
/* pending requests get nuked */
if (likely(ep->ep))
usb_ep_disable(ep->ep);
++ep;
+ if (epfile)
+ epfile->ep = NULL;
spin_unlock_irqrestore(&func->ffs->eps_lock, flags);
if (epfile) {
- epfile->ep = NULL;
+ mutex_lock(&epfile->mutex);
kfree(epfile->read_buffer);
epfile->read_buffer = NULL;
mutex_unlock(&epfile->mutex);