All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Gross <mgross@linux.intel.com>
To: lkml <linux-kernel@vger.kernel.org>,
	usbdev <linux-usb-devel@lists.sourceforge.net>
Subject: [patch] usb-skeleton leaking locks on open.
Date: Mon, 24 Sep 2007 09:18:22 -0700	[thread overview]
Message-ID: <20070924161822.GA4525@linux.intel.com> (raw)

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;

             reply	other threads:[~2007-09-24 16:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-24 16:18 Mark Gross [this message]
2007-09-24 16:26 ` [patch] usb-skeleton leaking locks on open Mark Gross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070924161822.GA4525@linux.intel.com \
    --to=mgross@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.