Skip to contentSkip to conversation

Patch "usb: gadget: f_fs: edit epfile->ep under lock" has been added to the 4.8-stable tree

PATCH [email protected] 1 participant 1 message Nov 19, 2016

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

    usb: gadget: f_fs: edit epfile->ep under lock

to the 4.8-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
usb-gadget-f_fs-edit-epfile-ep-under-lock.patch
and it can be found in the queue-4.8 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 454915dde06a51133750c6745f0ba57361ba209d Mon Sep 17 00:00:00 2001

From: Michal Nazarewicz <[email protected]>
Date: Tue, 4 Oct 2016 02:07:33 +0200
Subject: usb: gadget: f_fs: edit epfile->ep under lock

From: Michal Nazarewicz <[email protected]>

commit 454915dde06a51133750c6745f0ba57361ba209d upstream.

epfile->ep is protected by ffs->eps_lock (not epfile->mutex) so clear it while holding the spin lock.

---
 drivers/usb/gadget/function/f_fs.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/usb/gadget/function/f_fs.c +3 -3
@@ -1722,17 +1722,17 @@ static void ffs_func_eps_disable(struct
 	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);

Patches currently in stable-queue which might be from [email protected] are

queue-4.8/usb-gadget-f_fs-edit-epfile-ep-under-lock.patch queue-4.8/usb-gadget-f_fs-stop-sleeping-in-ffs_func_eps_disable.patch