mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Mack <daniel@caiaq.de>
To: linux-kernel@vger.kernel.org
Cc: Daniel Mack <daniel@caiaq.de>,
	Greg Kroah-Hartman <gregkh@suse.de>, Alan Cox <alan@redhat.com>,
	Alan Stern <stern@rowland.harvard.edu>,
	Oliver Neukum <oneukum@suse.de>, Alan Cox <alan@linux.intel.com>,
	linux-usb@vger.kernel.org
Subject: [PATCH] [usb-serial] fix Ooops on uplug
Date: Mon, 20 Jul 2009 19:51:53 +0200	[thread overview]
Message-ID: <1248112313-7842-1-git-send-email-daniel@caiaq.de> (raw)
In-Reply-To: <20090720155502.50b84ae9@lxorguk.ukuu.org.uk>

When an USB serial adapter is disconnected and <Enter> is pressed on a
connection still open on it (cu, minicom, ...), the kernel crashes.

The reason is that the serial port's resources are freed upon disconnect
(in serial_hangup()) but the tty device layer is not made aware of that.
Hence, the close callback will later access the resources again.

Fix that by postponing the resources freeing to the close callback and
remove it from the hangup callback.

Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Alan Cox <alan@redhat.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Oliver Neukum <oneukum@suse.de>
Cc: Alan Cox <alan@linux.intel.com>
Cc: linux-usb@vger.kernel.org
---
 drivers/usb/serial/usb-serial.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index bd7581b..77cb3cd 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -355,7 +355,6 @@ static void serial_hangup(struct tty_struct *tty)
 	struct usb_serial_port *port = tty->driver_data;
 	serial_do_down(port);
 	tty_port_hangup(&port->port);
-	serial_do_free(port);
 }
 
 static int serial_write(struct tty_struct *tty, const unsigned char *buf,
-- 
1.6.3.1


       reply	other threads:[~2009-07-20 17:52 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20090720155502.50b84ae9@lxorguk.ukuu.org.uk>
2009-07-20 17:51 ` Daniel Mack [this message]
2009-07-20 22:48   ` Alan Cox
2009-07-20 21:58     ` Daniel Mack
2009-07-20 23:45       ` Alan Cox
2009-07-21 15:53         ` Alan Stern
2009-07-21 15:56           ` Daniel Mack
2009-07-21 16:00             ` Alan Cox
2009-07-21 16:11               ` Alan Stern
2009-07-21 16:18                 ` Alan Cox
2009-07-21 16:16           ` Alan Cox
2009-07-21 16:19             ` Daniel Mack
2009-07-21 16:28               ` Alan Cox
2009-07-21 18:36             ` Alan Stern
2009-07-21 19:21               ` Alan Cox
2009-07-21 21:38                 ` Alan Stern
2009-07-21 22:55                   ` Alan Cox
2009-07-22 14:44                     ` Alan Stern
2009-07-22 16:17                       ` Alan Cox
2009-07-22 18:21                         ` Alan Stern
2009-07-22 22:35                           ` Alan Cox
2009-07-22 22:45                             ` Alan Stern
2009-07-22 22:48                               ` Alan Cox
2009-07-20 23:32   ` Alan Cox

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=1248112313-7842-1-git-send-email-daniel@caiaq.de \
    --to=daniel@caiaq.de \
    --cc=alan@linux.intel.com \
    --cc=alan@redhat.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=oneukum@suse.de \
    --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

Powered by JetHome