Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753493AbZGTRwT (ORCPT ); Mon, 20 Jul 2009 13:52:19 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753462AbZGTRwS (ORCPT ); Mon, 20 Jul 2009 13:52:18 -0400 Received: from buzzloop.caiaq.de ([212.112.241.133]:50215 "EHLO buzzloop.caiaq.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753431AbZGTRwR (ORCPT ); Mon, 20 Jul 2009 13:52:17 -0400 From: Daniel Mack To: linux-kernel@vger.kernel.org Cc: Daniel Mack , Greg Kroah-Hartman , Alan Cox , Alan Stern , Oliver Neukum , Alan Cox , linux-usb@vger.kernel.org Subject: [PATCH] [usb-serial] fix Ooops on uplug Date: Mon, 20 Jul 2009 19:51:53 +0200 Message-Id: <1248112313-7842-1-git-send-email-daniel@caiaq.de> X-Mailer: git-send-email 1.6.3.1 In-Reply-To: <20090720155502.50b84ae9@lxorguk.ukuu.org.uk> References: <20090720155502.50b84ae9@lxorguk.ukuu.org.uk> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1542 Lines: 41 When an USB serial adapter is disconnected and 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 Cc: Greg Kroah-Hartman Cc: Alan Cox Cc: Alan Stern Cc: Oliver Neukum Cc: Alan Cox 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/