Skip to content

Commit

Permalink
USB: usb-skeleton leaking locks on open
Browse files Browse the repository at this point in the history
This weekend I was hacking around with a trivial USB driver for talking
to the boot load firmware of a USB Bit Whacker.  It's running the
MicroChip Pic18 boot loader firmware and I'm putting together a flash
program for writing new FW to the thing.

Anyway in my use of the usb-skeleton.c as my starting point I discovered
my test program was getting hung up after attempting to write a buffer.
The application and driver where hung in a way that required me to
reboot to get it to clean up so I could try again.

It turned out the code path through skel_open can grap the driver's
io_mutex lock and forget to release it.

The following patch fixes the problem for me.

Signed-off-by: Mark Gross <mgross@linux.intel.com>
Cc: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Mark Gross authored and Greg Kroah-Hartman committed Oct 12, 2007
1 parent 6840d25 commit f729405
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/usb/usb-skeleton.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ static int skel_open(struct inode *inode, struct file *file)

/* save our object in the file's private structure */
file->private_data = dev;
mutex_unlock(&dev->io_mutex);

exit:
return retval;
Expand Down

0 comments on commit f729405

Please sign in to comment.