mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Brownell <david-b@pacbell.net>
To: Duncan Sands <duncan.sands@math.u-psud.fr>
Cc: Kernel List <linux-kernel@vger.kernel.org>,
	rml@tech9.net, linux-usb-devel@lists.sourceforge.net,
	Johannes Erdfelt <johannes@erdfelt.com>
Subject: Re: [linux-usb-devel] Re: 2.5.8-pre3: kernel BUG at usb.c:849! (preempt_count 1)
Date: Wed, 10 Apr 2002 10:23:12 -0700	[thread overview]
Message-ID: <071e01c1e0b4$64f382e0$6800000a@brownell.org> (raw)
In-Reply-To: <E16vHsQ-0000Jy-00@baldrick> <20020410114144.N8314@sventech.com> <06da01c1e0ae$69106ce0$6800000a@brownell.org> <E16vLJx-00028n-00@baldrick>

[-- Attachment #1: Type: text/plain, Size: 1238 bytes --]

> > And what usb device driver(s) were supposed to have stopped
> > using "device 3"?  I've only noticed such device refcounting bugs
> > being caused by the USB device drivers with bad disconnect()
> > routines, not usbcore or any of the host controller drivers, but of
> > course that can change.
> 
> Ha!
> 
> $ cat /proc/bus/usb/drivers
>          usbfs
>          hub
> 
> There are no other drivers!  I have a USB webcam and a modem
> ... has a user space driver that works via usbfs.

... OK, this is sounding familiar.  "usbfs" has some recently noted
bugs in its disconnect() routine.  That SpeedTouch driver seems to
be triggering them with regularity, though more often with usb-ohci.

The ksymoops info you sent is compatible with the bug being in
the usbfs code:  exactly what I'd expect such a BUG() to show.

I hate to send around untested patches, but I think the one I've
attached is at least in the right direction.  (Attachment, to avoid
mangling by mailers...)  It's an update of what I sent around late
last month to address someone's SpeedTouch oopsing with
usb-ohci (!) on 2.4.19-pre2, redone against 2.5.8-pre3, which
compiles.  I hope it doesn't create new oopses.

If it works for you, let us know ...

- Dave



[-- Attachment #2: devio-0410.patch --]
[-- Type: application/octet-stream, Size: 893 bytes --]

--- drivers/usb-dist/core/devio.c	Sat Apr  6 15:12:31 2002
+++ drivers/usb/core/devio.c	Wed Apr 10 10:11:38 2002
@@ -297,7 +297,9 @@
 }
 
 /*
- * interface claiming
+ * interface claims are made only at the request of user level code,
+ * which can also release them (explicitly or by closing files).
+ * they're also undone when devices disconnect.
  */
 
 static void *driver_probe(struct usb_device *dev, unsigned int intf,
@@ -310,8 +312,20 @@
 {
 	struct dev_state *ps = (struct dev_state *)context;
 
-	if (ps)
-		ps->ifclaimed = 0;
+	if (!ps)
+		return;
+
+	/* this waits till synchronous requests complete */
+	down_write (&ps->devsem);
+
+	/* prevent new I/O requests */
+	ps->dev = 0;
+	ps->ifclaimed = 0;
+
+	/* force async requests to complete */
+	destroy_all_async (ps);
+
+	up_write (&ps->devsem);
 }
 
 struct usb_driver usbdevfs_driver = {

  reply	other threads:[~2002-04-10 17:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-10 13:11 Duncan Sands
2002-04-10 15:41 ` Johannes Erdfelt
2002-04-10 16:40   ` [linux-usb-devel] " David Brownell
2002-04-10 16:51     ` Duncan Sands
2002-04-10 17:23       ` David Brownell [this message]
2002-04-10 22:20         ` Duncan Sands
2002-04-10 17:00   ` Robert Love
2002-04-10 17:11   ` Duncan Sands

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='071e01c1e0b4$64f382e0$6800000a@brownell.org' \
    --to=david-b@pacbell.net \
    --cc=duncan.sands@math.u-psud.fr \
    --cc=johannes@erdfelt.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb-devel@lists.sourceforge.net \
    --cc=rml@tech9.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®