Skip to content

Commit

Permalink
usb: gadget: f_fs: edit epfile->ep under lock
Browse files Browse the repository at this point in the history
epfile->ep is protected by ffs->eps_lock (not epfile->mutex) so clear it
while holding the spin lock.

Tested-by: John Stultz <[email protected]>
Tested-by: Chen Yu <[email protected]>
Signed-off-by: Michal Nazarewicz <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
  • Loading branch information
mina86 authored and Felipe Balbi committed Oct 17, 2016
1 parent a07ce8d commit 454915d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/usb/gadget/function/f_fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1725,17 +1725,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);
Expand Down

0 comments on commit 454915d

Please sign in to comment.