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
@@ -92,7 +92,7 @@ static int debug;
|
||||
* Function prototypes
|
||||
*/
|
||||
static int mct_u232_startup(struct usb_serial *serial);
|
||||
static void mct_u232_shutdown(struct usb_serial *serial);
|
||||
static void mct_u232_release(struct usb_serial *serial);
|
||||
static int mct_u232_open(struct tty_struct *tty,
|
||||
struct usb_serial_port *port, struct file *filp);
|
||||
static void mct_u232_close(struct usb_serial_port *port);
|
||||
@@ -149,7 +149,7 @@ static struct usb_serial_driver mct_u232_device = {
|
||||
.tiocmget = mct_u232_tiocmget,
|
||||
.tiocmset = mct_u232_tiocmset,
|
||||
.attach = mct_u232_startup,
|
||||
.shutdown = mct_u232_shutdown,
|
||||
.release = mct_u232_release,
|
||||
};
|
||||
|
||||
|
||||
@@ -407,7 +407,7 @@ static int mct_u232_startup(struct usb_serial *serial)
|
||||
} /* mct_u232_startup */
|
||||
|
||||
|
||||
static void mct_u232_shutdown(struct usb_serial *serial)
|
||||
static void mct_u232_release(struct usb_serial *serial)
|
||||
{
|
||||
struct mct_u232_private *priv;
|
||||
int i;
|
||||
@@ -417,12 +417,9 @@ static void mct_u232_shutdown(struct usb_serial *serial)
|
||||
for (i = 0; i < serial->num_ports; ++i) {
|
||||
/* My special items, the standard routines free my urbs */
|
||||
priv = usb_get_serial_port_data(serial->port[i]);
|
||||
if (priv) {
|
||||
usb_set_serial_port_data(serial->port[i], NULL);
|
||||
kfree(priv);
|
||||
}
|
||||
kfree(priv);
|
||||
}
|
||||
} /* mct_u232_shutdown */
|
||||
} /* mct_u232_release */
|
||||
|
||||
static int mct_u232_open(struct tty_struct *tty,
|
||||
struct usb_serial_port *port, struct file *filp)
|
||||
|
Reference in New Issue
Block a user