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
@ -47,7 +47,7 @@ static void visor_unthrottle(struct tty_struct *tty);
|
||||
static int visor_probe(struct usb_serial *serial,
|
||||
const struct usb_device_id *id);
|
||||
static int visor_calc_num_ports(struct usb_serial *serial);
|
||||
static void visor_shutdown(struct usb_serial *serial);
|
||||
static void visor_release(struct usb_serial *serial);
|
||||
static void visor_write_bulk_callback(struct urb *urb);
|
||||
static void visor_read_bulk_callback(struct urb *urb);
|
||||
static void visor_read_int_callback(struct urb *urb);
|
||||
@ -202,7 +202,7 @@ static struct usb_serial_driver handspring_device = {
|
||||
.attach = treo_attach,
|
||||
.probe = visor_probe,
|
||||
.calc_num_ports = visor_calc_num_ports,
|
||||
.shutdown = visor_shutdown,
|
||||
.release = visor_release,
|
||||
.write = visor_write,
|
||||
.write_room = visor_write_room,
|
||||
.write_bulk_callback = visor_write_bulk_callback,
|
||||
@ -227,7 +227,7 @@ static struct usb_serial_driver clie_5_device = {
|
||||
.attach = clie_5_attach,
|
||||
.probe = visor_probe,
|
||||
.calc_num_ports = visor_calc_num_ports,
|
||||
.shutdown = visor_shutdown,
|
||||
.release = visor_release,
|
||||
.write = visor_write,
|
||||
.write_room = visor_write_room,
|
||||
.write_bulk_callback = visor_write_bulk_callback,
|
||||
@ -918,7 +918,7 @@ static int clie_5_attach(struct usb_serial *serial)
|
||||
return generic_startup(serial);
|
||||
}
|
||||
|
||||
static void visor_shutdown(struct usb_serial *serial)
|
||||
static void visor_release(struct usb_serial *serial)
|
||||
{
|
||||
struct visor_private *priv;
|
||||
int i;
|
||||
@ -927,10 +927,7 @@ static void visor_shutdown(struct usb_serial *serial)
|
||||
|
||||
for (i = 0; i < serial->num_ports; i++) {
|
||||
priv = usb_get_serial_port_data(serial->port[i]);
|
||||
if (priv) {
|
||||
usb_set_serial_port_data(serial->port[i], NULL);
|
||||
kfree(priv);
|
||||
}
|
||||
kfree(priv);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user