diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2009-06-02 11:53:55 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-06-16 00:44:47 -0400 |
commit | f9c99bb8b3a1ec81af68d484a551307326c2e933 (patch) | |
tree | 9031ebe390ecd558d54ad484dde5ba66dcf823b7 /drivers/usb/serial/mos7720.c | |
parent | c706ebdfc8955b850e477255a8c0f93f9f14712d (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/mos7720.c')
-rw-r--r-- | drivers/usb/serial/mos7720.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c index 9e1a013ee7f6..bfc5ce000ef9 100644 --- a/drivers/usb/serial/mos7720.c +++ b/drivers/usb/serial/mos7720.c | |||
@@ -1521,19 +1521,16 @@ static int mos7720_startup(struct usb_serial *serial) | |||
1521 | return 0; | 1521 | return 0; |
1522 | } | 1522 | } |
1523 | 1523 | ||
1524 | static void mos7720_shutdown(struct usb_serial *serial) | 1524 | static void mos7720_release(struct usb_serial *serial) |
1525 | { | 1525 | { |
1526 | int i; | 1526 | int i; |
1527 | 1527 | ||
1528 | /* free private structure allocated for serial port */ | 1528 | /* free private structure allocated for serial port */ |
1529 | for (i = 0; i < serial->num_ports; ++i) { | 1529 | for (i = 0; i < serial->num_ports; ++i) |
1530 | kfree(usb_get_serial_port_data(serial->port[i])); | 1530 | kfree(usb_get_serial_port_data(serial->port[i])); |
1531 | usb_set_serial_port_data(serial->port[i], NULL); | ||
1532 | } | ||
1533 | 1531 | ||
1534 | /* free private structure allocated for serial device */ | 1532 | /* free private structure allocated for serial device */ |
1535 | kfree(usb_get_serial_data(serial)); | 1533 | kfree(usb_get_serial_data(serial)); |
1536 | usb_set_serial_data(serial, NULL); | ||
1537 | } | 1534 | } |
1538 | 1535 | ||
1539 | static struct usb_driver usb_driver = { | 1536 | static struct usb_driver usb_driver = { |
@@ -1558,7 +1555,7 @@ static struct usb_serial_driver moschip7720_2port_driver = { | |||
1558 | .throttle = mos7720_throttle, | 1555 | .throttle = mos7720_throttle, |
1559 | .unthrottle = mos7720_unthrottle, | 1556 | .unthrottle = mos7720_unthrottle, |
1560 | .attach = mos7720_startup, | 1557 | .attach = mos7720_startup, |
1561 | .shutdown = mos7720_shutdown, | 1558 | .release = mos7720_release, |
1562 | .ioctl = mos7720_ioctl, | 1559 | .ioctl = mos7720_ioctl, |
1563 | .set_termios = mos7720_set_termios, | 1560 | .set_termios = mos7720_set_termios, |
1564 | .write = mos7720_write, | 1561 | .write = mos7720_write, |