From: "Bruno Prémont" <bonbons@linux-vserver.org>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>, Greg KH <greg@kroah.com>,
Kernel development list <linux-kernel@vger.kernel.org>,
USB list <linux-usb@vger.kernel.org>,
"Rafael J. Wysocki" <rjw@sisk.pl>
Subject: Re: 2.6.31-rc5 regression: Oops when USB Serial disconnected while in use
Date: Thu, 20 Aug 2009 21:25:49 +0200 [thread overview]
Message-ID: <20090820212549.7b4d93c9@neptune.home> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0908191834180.26174-100000@iolanthe.rowland.org>
On Wed, 19 August 2009 Alan Stern <stern@rowland.harvard.edu> wrote:
> On Wed, 19 Aug 2009, Alan Cox wrote:
>
> > > So Alan, what's the explanation? An unsuccessful open method call
> > > should not lead to a close method call.
> >
> > For tty it always has since back in 0.9x, and most drivers depend
> > upon this behaviour.
>
> Curiouser and curiouser...
>
> Okay Bruno, try out this patch and let's see if it helps. It should
> fix the problem with the pl2303. I'm not so sure about the FTDI
> device because that driver maintains its own reference count for its
> private data.
>
> Alan Stern
No, that one does not really help (well it avoids dereferencing a bad
pointer (NULL for pl2302 or invalid for ftdi) with serial_do_free() after
destroy_serial() but is does underflow module refcount (refcount ends
up at 2^32-1) and lets the kernel stall/panic a short time later without
any useful information at that moment (only very first line of trace
ever appears) [ftdi for the panic/freeze].
So I would say at best it's just a step towards the solution...
there are still unbalanced operations left (module refcount being the
visible one, then probably the already mentioned private book-keeping
of ftdi)!
Bruno
> Index: usb-2.6/drivers/usb/serial/usb-serial.c
> ===================================================================
> --- usb-2.6.orig/drivers/usb/serial/usb-serial.c
> +++ usb-2.6/drivers/usb/serial/usb-serial.c
> @@ -209,8 +209,13 @@ static int serial_open (struct tty_struc
> * to be acquired while serial->disc_mutex is held.
> */
> mutex_unlock(&serial->disc_mutex);
> +
> + /* For reasons that have been lost in antiquity, the TTY
> layer calls
> + * our close method even if the open call fails. Hence we
> must not
> + * drop the reference obtained by usb_serial_get_by_index().
> + */
> if (retval)
> - goto bailout_serial_put;
> + return retval;
>
> if (mutex_lock_interruptible(&port->mutex)) {
> retval = -ERESTARTSYS;
> @@ -276,8 +281,6 @@ bailout_mutex_unlock:
> mutex_unlock(&port->mutex);
> bailout_port_put:
> put_device(&port->dev);
> -bailout_serial_put:
> - usb_serial_put(serial);
> return retval;
> }
>
>
next prev parent reply other threads:[~2009-08-20 19:36 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-08 17:47 Bruno Prémont
2009-08-09 14:02 ` Ozan Çağlayan
2009-08-09 15:00 ` Alan Stern
2009-08-10 15:18 ` Alan Stern
2009-08-10 15:44 ` Greg KH
2009-08-10 17:18 ` Bruno Prémont
2009-08-10 18:13 ` Greg KH
2009-08-10 18:35 ` Bruno Prémont
2009-08-10 18:51 ` Bruno Prémont
2009-08-10 19:29 ` Greg KH
2009-08-18 17:00 ` Bruno Prémont
2009-08-18 22:36 ` Greg KH
2009-08-18 23:16 ` Greg KH
2009-08-19 17:22 ` Bruno Prémont
2009-08-19 18:20 ` Alan Stern
2009-08-19 20:15 ` Bruno Prémont
2009-08-19 21:01 ` Alan Stern
2009-08-19 21:50 ` Alan Cox
2009-08-19 22:44 ` Alan Stern
2009-08-20 19:25 ` Bruno Prémont [this message]
2009-08-20 21:20 ` Alan Stern
2009-08-21 9:25 ` Bruno Prémont
2009-08-21 15:43 ` Alan Stern
2009-08-21 15:48 ` Alan Cox
2009-08-21 17:39 ` Alan Stern
2009-08-21 18:42 ` Alan Cox
2009-08-21 20:52 ` Alan Stern
2009-08-21 23:16 ` Alan Cox
2009-08-22 2:30 ` Alan Stern
2009-08-23 2:51 ` Alan Stern
2009-08-23 16:15 ` Alan Stern
2009-08-23 16:30 ` Bruno Prémont
2009-08-24 1:24 ` Alan Stern
2009-08-24 20:15 ` Bruno Prémont
2009-08-25 1:42 ` Alan Stern
2009-08-25 20:19 ` Bruno Prémont
2009-08-25 23:42 ` Alan Stern
2009-08-26 20:32 ` Bruno Prémont
2009-08-27 2:19 ` Alan Stern
2009-08-21 16:50 ` Bruno Prémont
2009-08-20 21:58 ` Alan Cox
2009-08-21 14:02 ` Alan Stern
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=20090820212549.7b4d93c9@neptune.home \
--to=bonbons@linux-vserver.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=rjw@sisk.pl \
--cc=stern@rowland.harvard.edu \
/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®