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
@@ -1521,19 +1521,16 @@ static int mos7720_startup(struct usb_serial *serial)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void mos7720_shutdown(struct usb_serial *serial)
|
||||
static void mos7720_release(struct usb_serial *serial)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* free private structure allocated for serial port */
|
||||
for (i = 0; i < serial->num_ports; ++i) {
|
||||
for (i = 0; i < serial->num_ports; ++i)
|
||||
kfree(usb_get_serial_port_data(serial->port[i]));
|
||||
usb_set_serial_port_data(serial->port[i], NULL);
|
||||
}
|
||||
|
||||
/* free private structure allocated for serial device */
|
||||
kfree(usb_get_serial_data(serial));
|
||||
usb_set_serial_data(serial, NULL);
|
||||
}
|
||||
|
||||
static struct usb_driver usb_driver = {
|
||||
@@ -1558,7 +1555,7 @@ static struct usb_serial_driver moschip7720_2port_driver = {
|
||||
.throttle = mos7720_throttle,
|
||||
.unthrottle = mos7720_unthrottle,
|
||||
.attach = mos7720_startup,
|
||||
.shutdown = mos7720_shutdown,
|
||||
.release = mos7720_release,
|
||||
.ioctl = mos7720_ioctl,
|
||||
.set_termios = mos7720_set_termios,
|
||||
.write = mos7720_write,
|
||||
|
Reference in New Issue
Block a user