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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
c706ebdfc8
commit
f9c99bb8b3
@@ -463,7 +463,7 @@ error:
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void opticon_shutdown(struct usb_serial *serial)
|
||||
static void opticon_disconnect(struct usb_serial *serial)
|
||||
{
|
||||
struct opticon_private *priv = usb_get_serial_data(serial);
|
||||
|
||||
@@ -471,9 +471,16 @@ static void opticon_shutdown(struct usb_serial *serial)
|
||||
|
||||
usb_kill_urb(priv->bulk_read_urb);
|
||||
usb_free_urb(priv->bulk_read_urb);
|
||||
}
|
||||
|
||||
static void opticon_release(struct usb_serial *serial)
|
||||
{
|
||||
struct opticon_private *priv = usb_get_serial_data(serial);
|
||||
|
||||
dbg("%s", __func__);
|
||||
|
||||
kfree(priv->bulk_in_buffer);
|
||||
kfree(priv);
|
||||
usb_set_serial_data(serial, NULL);
|
||||
}
|
||||
|
||||
static int opticon_suspend(struct usb_interface *intf, pm_message_t message)
|
||||
@@ -524,7 +531,8 @@ static struct usb_serial_driver opticon_device = {
|
||||
.close = opticon_close,
|
||||
.write = opticon_write,
|
||||
.write_room = opticon_write_room,
|
||||
.shutdown = opticon_shutdown,
|
||||
.disconnect = opticon_disconnect,
|
||||
.release = opticon_release,
|
||||
.throttle = opticon_throttle,
|
||||
.unthrottle = opticon_unthrottle,
|
||||
.ioctl = opticon_ioctl,
|
||||
|
Reference in New Issue
Block a user