public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] usb-skeleton leaking locks on open.
@ 2007-09-24 16:18 Mark Gross
  2007-09-24 16:26 ` Mark Gross
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Gross @ 2007-09-24 16:18 UTC (permalink / raw)
  To: lkml, usbdev

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.

--mgross

Signed-off-by: Mark Gross <mgross@linux.intel.com>

diff -urN -X linux-2.6.23-rc7/Documentation/dontdiff linux-2.6.23-rc7/drivers/usb/usb-skeleton.c linux-2.6.23-rc7-bugfix/drivers/usb/usb-skeleton.c
--- linux-2.6.23-rc7/drivers/usb/usb-skeleton.c	2007-09-24 08:57:54.000000000 -0700
+++ linux-2.6.23-rc7-bugfix/drivers/usb/usb-skeleton.c	2007-09-24 09:01:43.000000000 -0700
@@ -125,6 +125,7 @@
 
 	/* save our object in the file's private structure */
 	file->private_data = dev;
+	mutex_unlock(&dev->io_mutex);
 
 exit:
 	return retval;

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

* Re: [patch] usb-skeleton leaking locks on open.
  2007-09-24 16:18 [patch] usb-skeleton leaking locks on open Mark Gross
@ 2007-09-24 16:26 ` Mark Gross
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Gross @ 2007-09-24 16:26 UTC (permalink / raw)
  To: lkml, usbdev

forgot to CC greg ...


On Mon, Sep 24, 2007 at 09:18:22AM -0700, Mark Gross wrote:
> 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.
> 
> --mgross
> 
> Signed-off-by: Mark Gross <mgross@linux.intel.com>
> 
> diff -urN -X linux-2.6.23-rc7/Documentation/dontdiff linux-2.6.23-rc7/drivers/usb/usb-skeleton.c linux-2.6.23-rc7-bugfix/drivers/usb/usb-skeleton.c
> --- linux-2.6.23-rc7/drivers/usb/usb-skeleton.c	2007-09-24 08:57:54.000000000 -0700
> +++ linux-2.6.23-rc7-bugfix/drivers/usb/usb-skeleton.c	2007-09-24 09:01:43.000000000 -0700
> @@ -125,6 +125,7 @@
>  
>  	/* save our object in the file's private structure */
>  	file->private_data = dev;
> +	mutex_unlock(&dev->io_mutex);
>  
>  exit:
>  	return retval;
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

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

end of thread, other threads:[~2007-09-24 16:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-24 16:18 [patch] usb-skeleton leaking locks on open Mark Gross
2007-09-24 16:26 ` Mark Gross

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox