aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/opticon.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/opticon.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/opticon.c')
-rw-r--r--drivers/usb/serial/opticon.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/usb/serial/opticon.c b/drivers/usb/serial/opticon.c
index c20480aa9755..336bba79ad32 100644
--- a/drivers/usb/serial/opticon.c
+++ b/drivers/usb/serial/opticon.c
@@ -463,7 +463,7 @@ error:
463 return retval; 463 return retval;
464} 464}
465 465
466static void opticon_shutdown(struct usb_serial *serial) 466static void opticon_disconnect(struct usb_serial *serial)
467{ 467{
468 struct opticon_private *priv = usb_get_serial_data(serial); 468 struct opticon_private *priv = usb_get_serial_data(serial);
469 469
@@ -471,9 +471,16 @@ static void opticon_shutdown(struct usb_serial *serial)
471 471
472 usb_kill_urb(priv->bulk_read_urb); 472 usb_kill_urb(priv->bulk_read_urb);
473 usb_free_urb(priv->bulk_read_urb); 473 usb_free_urb(priv->bulk_read_urb);
474}
475
476static void opticon_release(struct usb_serial *serial)
477{
478 struct opticon_private *priv = usb_get_serial_data(serial);
479
480 dbg("%s", __func__);
481
474 kfree(priv->bulk_in_buffer); 482 kfree(priv->bulk_in_buffer);
475 kfree(priv); 483 kfree(priv);
476 usb_set_serial_data(serial, NULL);
477} 484}
478 485
479static int opticon_suspend(struct usb_interface *intf, pm_message_t message) 486static int opticon_suspend(struct usb_interface *intf, pm_message_t message)
@@ -524,7 +531,8 @@ static struct usb_serial_driver opticon_device = {
524 .close = opticon_close, 531 .close = opticon_close,
525 .write = opticon_write, 532 .write = opticon_write,
526 .write_room = opticon_write_room, 533 .write_room = opticon_write_room,
527 .shutdown = opticon_shutdown, 534 .disconnect = opticon_disconnect,
535 .release = opticon_release,
528 .throttle = opticon_throttle, 536 .throttle = opticon_throttle,
529 .unthrottle = opticon_unthrottle, 537 .unthrottle = opticon_unthrottle,
530 .ioctl = opticon_ioctl, 538 .ioctl = opticon_ioctl,