All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/1] USB: inode.c: fix unbalanced spin_lock in ep0_write
@ 2015-12-11 21:13 David Eccher
  2015-12-16 16:54 ` Felipe Balbi
  0 siblings, 1 reply; 3+ messages in thread
From: David Eccher @ 2015-12-11 21:13 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Greg Kroah-Hartman, Al Viro, linux-usb, linux-kernel,
	David Eccher

Fix bad unlock balance: ep0_write enter with the locks locked from
inode.c:1769, hence it must exit with spinlock held to avoid double
unlock in dev_config.

Signed-off-by: David Eccher <d.eccher@gmail.com>
---
 drivers/usb/gadget/legacy/inode.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c
index f454c7a..365afd7 100644
--- a/drivers/usb/gadget/legacy/inode.c
+++ b/drivers/usb/gadget/legacy/inode.c
@@ -1137,10 +1137,9 @@ ep0_write (struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
 						dev->gadget->ep0, dev->req,
 						GFP_KERNEL);
 				}
+				spin_lock_irq(&dev->lock);
 				if (retval < 0) {
-					spin_lock_irq (&dev->lock);
 					clean_req (dev->gadget->ep0, dev->req);
-					spin_unlock_irq (&dev->lock);
 				} else
 					retval = len;
 
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-12-16 16:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-11 21:13 [PATCH v2 1/1] USB: inode.c: fix unbalanced spin_lock in ep0_write David Eccher
2015-12-16 16:54 ` Felipe Balbi
2015-12-16 16:55   ` Felipe Balbi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.