lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 20 Aug 2009 21:25:49 +0200
From:	Bruno Prémont <bonbons@...ux-vserver.org>
To:	Alan Stern <stern@...land.harvard.edu>
Cc:	Alan Cox <alan@...rguk.ukuu.org.uk>, Greg KH <greg@...ah.com>,
	Kernel development list <linux-kernel@...r.kernel.org>,
	USB list <linux-usb@...r.kernel.org>,
	"Rafael J. Wysocki" <rjw@...k.pl>
Subject: Re: 2.6.31-rc5 regression: Oops when USB Serial disconnected while
 in use

On Wed, 19 August 2009 Alan Stern <stern@...land.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;
>  }
>  
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ