Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

USB gadget: gadgetfs dont try to lock before free

I spotted this during my tests with -rt on arm. The -rt patch contains
some better tools
to diagnose problems with locks and some other things...

Original code tries to take semaphore in BUG_ON and then free the memory
with this semaphore.


Signed-off-by: Milan Svoboda <msvoboda@ra.rockwell.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


authored by

Milan Svoboda and committed by
Greg Kroah-Hartman
a94da897 e22fc27c

-1
-1
drivers/usb/gadget/inode.c
··· 223 223 /* needs no more cleanup */ 224 224 BUG_ON (!list_empty (&data->epfiles)); 225 225 BUG_ON (waitqueue_active (&data->wait)); 226 - BUG_ON (down_trylock (&data->lock) != 0); 227 226 kfree (data); 228 227 } 229 228