Messages in this thread Patch in this message | | | Date | Tue, 16 Jun 2009 09:42:12 +0200 | From | Vitaly Mayatskikh <> | Subject | [PATCH] Fix OOPS in pl2303 |
| |
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 <v.mayatskih@gmail.com>
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
| |