aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/mct_u232.c
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2009-06-02 11:53:55 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-06-16 00:44:47 -0400
commitf9c99bb8b3a1ec81af68d484a551307326c2e933 (patch)
tree9031ebe390ecd558d54ad484dde5ba66dcf823b7 /drivers/usb/serial/mct_u232.c
parentc706ebdfc8955b850e477255a8c0f93f9f14712d (diff)
USB: usb-serial: replace shutdown with disconnect, release
This patch (as1254) splits up the shutdown method of usb_serial_driver into a disconnect and a release method. The problem is that the usb-serial core was calling shutdown during disconnect handling, but drivers didn't expect it to be called until after all the open file references had been closed. The result was an oops when the close method tried to use memory that had been deallocated by shutdown. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/serial/mct_u232.c')
-rw-r--r--drivers/usb/serial/mct_u232.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c
index 873795548fc0..d8825e159aa5 100644
--- a/drivers/usb/serial/mct_u232.c
+++ b/drivers/usb/serial/mct_u232.c
@@ -92,7 +92,7 @@ static int debug;
92 * Function prototypes 92 * Function prototypes
93 */ 93 */
94static int mct_u232_startup(struct usb_serial *serial); 94static int mct_u232_startup(struct usb_serial *serial);
95static void mct_u232_shutdown(struct usb_serial *serial); 95static void mct_u232_release(struct usb_serial *serial);
96static int mct_u232_open(struct tty_struct *tty, 96static int mct_u232_open(struct tty_struct *tty,
97 struct usb_serial_port *port, struct file *filp); 97 struct usb_serial_port *port, struct file *filp);
98static void mct_u232_close(struct usb_serial_port *port); 98static void mct_u232_close(struct usb_serial_port *port);
@@ -149,7 +149,7 @@ static struct usb_serial_driver mct_u232_device = {
149 .tiocmget = mct_u232_tiocmget, 149 .tiocmget = mct_u232_tiocmget,
150 .tiocmset = mct_u232_tiocmset, 150 .tiocmset = mct_u232_tiocmset,
151 .attach = mct_u232_startup, 151 .attach = mct_u232_startup,
152 .shutdown = mct_u232_shutdown, 152 .release = mct_u232_release,
153}; 153};
154 154
155 155
@@ -407,7 +407,7 @@ static int mct_u232_startup(struct usb_serial *serial)
407} /* mct_u232_startup */ 407} /* mct_u232_startup */
408 408
409 409
410static void mct_u232_shutdown(struct usb_serial *serial) 410static void mct_u232_release(struct usb_serial *serial)
411{ 411{
412 struct mct_u232_private *priv; 412 struct mct_u232_private *priv;
413 int i; 413 int i;
@@ -417,12 +417,9 @@ static void mct_u232_shutdown(struct usb_serial *serial)
417 for (i = 0; i < serial->num_ports; ++i) { 417 for (i = 0; i < serial->num_ports; ++i) {
418 /* My special items, the standard routines free my urbs */ 418 /* My special items, the standard routines free my urbs */
419 priv = usb_get_serial_port_data(serial->port[i]); 419 priv = usb_get_serial_port_data(serial->port[i]);
420 if (priv) { 420 kfree(priv);
421 usb_set_serial_port_data(serial->port[i], NULL);
422 kfree(priv);
423 }
424 } 421 }
425} /* mct_u232_shutdown */ 422} /* mct_u232_release */
426 423
427static int mct_u232_open(struct tty_struct *tty, 424static int mct_u232_open(struct tty_struct *tty,
428 struct usb_serial_port *port, struct file *filp) 425 struct usb_serial_port *port, struct file *filp)