linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: m00150988@huawei.com, USB list <linux-usb@vger.kernel.org>,
	Kernel development list <linux-kernel@vger.kernel.org>,
	zihan@huawei.com, Lin Lei <Lin.Lei@huawei.com>,
	Franko Fang <huananhu@huawei.com>,
	wangyeqi@huawei.com
Subject: Re: [PATCH] fix oops in usbserial_cleanup function;
Date: Fri, 15 Oct 2010 12:09:13 -0700	[thread overview]
Message-ID: <20101015190913.GA8098@kroah.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1010151009050.1603-100000@iolanthe.rowland.org>

On Fri, Oct 15, 2010 at 10:15:34AM -0400, Alan Stern wrote:
> On Fri, 15 Oct 2010 m00150988@huawei.com wrote:
> 
> > From:ma rui <m00150988@huawei.com>
> > 1. I find this bug on OpenSUSE 11.3 which kernel version is 2.6.34, but the latest kernel version 2.6.36-rc7 aslo have this bug. This patch is based on
> > the kernel of 2.6.36-rc7
> > 2. bug report:
> >    a. Install huawei datacard dashboard on OpenSUSE 11.3
> >    b. Plug in huawei datacard into OpenSUSE 11.3 which kernel version is 2.6.36-rc7
> >    c. After the dashboard has detected the device, I pull out the usb datacard
> >    d. Close dashboard,then kernel panic will happen in usbserial_clean function
> > 
> > Yes, the datacard exit without close the port. 
> > 
> > But after the dashboard connect internet with hauwei datacard, then Hibernate/resume, the bug will happen too.
> > Do you have any other good idea to resolve this bug,or please apply my patch,thanks. :)
> > 
> > 
> > Signed-off-by: ma rui <m00150988@huawei.com>
> > 
> > 
> > diff -uprN -X linux-2.6.36-rc7_orig/Documentation/dontdiff linux-2.6.36-rc7_orig/drivers/usb/serial/usb-serial.c linux-2.6.36-rc7/drivers/usb/serial/usb-serial.c
> > --- linux-2.6.36-rc7_orig/drivers/usb/serial/usb-serial.c	2010-10-06 16:39:52.000000000 -0400
> > +++ linux-2.6.36-rc7/drivers/usb/serial/usb-serial.c	2010-10-15 01:57:36.000000000 -0400
> > @@ -328,6 +328,16 @@ static void serial_cleanup(struct tty_st
> >  	/* The console is magical.  Do not hang up the console hardware
> >  	 * or there will be tears.
> >  	 */
> > +	if (NULL == port)
> > +		return;
> > +	mutex_lock(&port->serial->disc_mutex);
> > +	if (port->serial->disconnected) {
> > +		return_serial(port->serial);
> > +		mutex_unlock(&port->serial->disc_mutex);
> > +		return;
> > +	}
> > +	mutex_unlock(&port->serial->disc_mutex);
> > +
> >  	if (port->port.console)
> >  		return;
> 
> This patch is clearly wrong, since it skips some of the actions that 
> should be taken by serial_cleanup even if the port is already 
> disconnected.
> 
> Besides, the main point of the patch is to avoid problems when 
> port = tty->driver_data turns out to be NULL.  But the only place where 
> tty->driver_data is set to NULL is further below in this same function!  
> So the problems should never arise.
> 
> If they do arise, it indicates there's a bug somewhere else.  That 
> other bug can't be fixed by changing this function.

Yeah, I agree.

Ma, what is the full oops message that you are seeing here when you
remove the device?  And does userspace still have the device open at
that time?  I'm guessing so as it sounds like the oops happens when the
port is then closed.  I can't duplicate that problem here.

thanks,

greg k-h

  reply	other threads:[~2010-10-15 19:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-15  8:30 [PATCH] fix oops in usbserial_cleanup function; m00150988
2010-10-15 14:15 ` Alan Stern
2010-10-15 19:09   ` Greg KH [this message]
2010-10-27  7:10     ` [PATCH] fix oops in usbserial_cleanup function marui
2010-10-27  9:32       ` Alan Cox
2010-10-29  5:07         ` marui
     [not found] <00c601cb6c1c$2c768500$ba260b0a@china.huawei.com>
2010-10-15  4:20 ` [PATCH] fix oops in usbserial_cleanup function; Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2010-10-15  4:14 m00150988
2010-10-15  4:25 ` Greg KH

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=20101015190913.GA8098@kroah.com \
    --to=greg@kroah.com \
    --cc=Lin.Lei@huawei.com \
    --cc=huananhu@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=m00150988@huawei.com \
    --cc=stern@rowland.harvard.edu \
    --cc=wangyeqi@huawei.com \
    --cc=zihan@huawei.com \
    /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;
as well as URLs for NNTP newsgroup(s).