Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761134AbZFPHmt (ORCPT ); Tue, 16 Jun 2009 03:42:49 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757856AbZFPHml (ORCPT ); Tue, 16 Jun 2009 03:42:41 -0400 Received: from mail-pz0-f187.google.com ([209.85.222.187]:39812 "EHLO mail-pz0-f187.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752729AbZFPHmj (ORCPT ); Tue, 16 Jun 2009 03:42:39 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:message-id:from:to:cc:subject:user-agent:mime-version :content-type; b=QrBsFcU4Sx4MKTBQLG0pLxoTb/btgwRcUzaFhabgnTtqDZrV4JqnxFcI3ZaJ/P1Xkz qhxJwAWivZabiS8RqQvuPQqOghqF/6qIqUnWc5m3Xwf6TjkL2TeQ+ztflFTckAjsxYUA rwiNXecKfLWGRSqHImexbYBQEingXbZHn56uM= Date: Tue, 16 Jun 2009 09:42:12 +0200 Message-ID: <87k53cy697.wl%vmayatsk@redhat.com> From: Vitaly Mayatskikh To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman Subject: [PATCH] Fix OOPS in pl2303 User-Agent: Wanderlust/2.15.6 (Almost Unreal) Emacs/22.3 Mule/5.0 (SAKAKI) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1581 Lines: 47 Kernel always OOPS in pl2303_close(), when serial converter disappears and pppd tries to close statistics files in sysfs, because priv structure was already freed in pl2302_shutdown(). This patch adds check for priv in pl2303_close(). Signed-off-by: Vitaly Mayatskikh diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index e02dc3d..945cfb0 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c @@ -674,19 +674,19 @@ static void pl2303_close(struct usb_serial_port *port) struct pl2303_private *priv = usb_get_serial_port_data(port); unsigned long flags; - dbg("%s - port %d", __func__, port->number); - - spin_lock_irqsave(&priv->lock, flags); - /* clear out any remaining data in the buffer */ - pl2303_buf_clear(priv->buf); - spin_unlock_irqrestore(&priv->lock, flags); + if (priv) { + dbg("%s - port %d", __func__, port->number); + spin_lock_irqsave(&priv->lock, flags); + /* clear out any remaining data in the buffer */ + pl2303_buf_clear(priv->buf); + spin_unlock_irqrestore(&priv->lock, flags); + } /* shutdown our urbs */ dbg("%s - shutting down urbs", __func__); usb_kill_urb(port->write_urb); usb_kill_urb(port->read_urb); usb_kill_urb(port->interrupt_in_urb); - } static int pl2303_open(struct tty_struct *tty, -- wbr, Vitaly -- 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/