2015-12-11 21:15:13

by David Eccher

[permalink] [raw]
Subject: [PATCH v2 1/1] USB: inode.c: fix unbalanced spin_lock in ep0_write

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 <[email protected]>
---
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


2015-12-16 16:54:52

by Felipe Balbi

[permalink] [raw]
Subject: Re: [PATCH v2 1/1] USB: inode.c: fix unbalanced spin_lock in ep0_write


Hi,

David Eccher <[email protected]> writes:
> 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 <[email protected]>

which commit is this fixing ? Do we need this backported to stable
kernels ?

--
balbi


Attachments:
signature.asc (818.00 B)

2015-12-16 16:55:51

by Felipe Balbi

[permalink] [raw]
Subject: Re: [PATCH v2 1/1] USB: inode.c: fix unbalanced spin_lock in ep0_write

Felipe Balbi <[email protected]> writes:

> Hi,
>
> David Eccher <[email protected]> writes:
>> 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 <[email protected]>
>
> which commit is this fixing ? Do we need this backported to stable
> kernels ?

oh, this has been like this since before git came to be. Nevermind.

--
balbi


Attachments:
signature.asc (818.00 B)