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/cypress_m8.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/cypress_m8.c')
-rw-r--r-- | drivers/usb/serial/cypress_m8.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index 669f93848539..9734085fd2fe 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c | |||
@@ -171,7 +171,7 @@ struct cypress_buf { | |||
171 | static int cypress_earthmate_startup(struct usb_serial *serial); | 171 | static int cypress_earthmate_startup(struct usb_serial *serial); |
172 | static int cypress_hidcom_startup(struct usb_serial *serial); | 172 | static int cypress_hidcom_startup(struct usb_serial *serial); |
173 | static int cypress_ca42v2_startup(struct usb_serial *serial); | 173 | static int cypress_ca42v2_startup(struct usb_serial *serial); |
174 | static void cypress_shutdown(struct usb_serial *serial); | 174 | static void cypress_release(struct usb_serial *serial); |
175 | static int cypress_open(struct tty_struct *tty, | 175 | static int cypress_open(struct tty_struct *tty, |
176 | struct usb_serial_port *port, struct file *filp); | 176 | struct usb_serial_port *port, struct file *filp); |
177 | static void cypress_close(struct usb_serial_port *port); | 177 | static void cypress_close(struct usb_serial_port *port); |
@@ -215,7 +215,7 @@ static struct usb_serial_driver cypress_earthmate_device = { | |||
215 | .id_table = id_table_earthmate, | 215 | .id_table = id_table_earthmate, |
216 | .num_ports = 1, | 216 | .num_ports = 1, |
217 | .attach = cypress_earthmate_startup, | 217 | .attach = cypress_earthmate_startup, |
218 | .shutdown = cypress_shutdown, | 218 | .release = cypress_release, |
219 | .open = cypress_open, | 219 | .open = cypress_open, |
220 | .close = cypress_close, | 220 | .close = cypress_close, |
221 | .dtr_rts = cypress_dtr_rts, | 221 | .dtr_rts = cypress_dtr_rts, |
@@ -242,7 +242,7 @@ static struct usb_serial_driver cypress_hidcom_device = { | |||
242 | .id_table = id_table_cyphidcomrs232, | 242 | .id_table = id_table_cyphidcomrs232, |
243 | .num_ports = 1, | 243 | .num_ports = 1, |
244 | .attach = cypress_hidcom_startup, | 244 | .attach = cypress_hidcom_startup, |
245 | .shutdown = cypress_shutdown, | 245 | .release = cypress_release, |
246 | .open = cypress_open, | 246 | .open = cypress_open, |
247 | .close = cypress_close, | 247 | .close = cypress_close, |
248 | .dtr_rts = cypress_dtr_rts, | 248 | .dtr_rts = cypress_dtr_rts, |
@@ -269,7 +269,7 @@ static struct usb_serial_driver cypress_ca42v2_device = { | |||
269 | .id_table = id_table_nokiaca42v2, | 269 | .id_table = id_table_nokiaca42v2, |
270 | .num_ports = 1, | 270 | .num_ports = 1, |
271 | .attach = cypress_ca42v2_startup, | 271 | .attach = cypress_ca42v2_startup, |
272 | .shutdown = cypress_shutdown, | 272 | .release = cypress_release, |
273 | .open = cypress_open, | 273 | .open = cypress_open, |
274 | .close = cypress_close, | 274 | .close = cypress_close, |
275 | .dtr_rts = cypress_dtr_rts, | 275 | .dtr_rts = cypress_dtr_rts, |
@@ -616,7 +616,7 @@ static int cypress_ca42v2_startup(struct usb_serial *serial) | |||
616 | } /* cypress_ca42v2_startup */ | 616 | } /* cypress_ca42v2_startup */ |
617 | 617 | ||
618 | 618 | ||
619 | static void cypress_shutdown(struct usb_serial *serial) | 619 | static void cypress_release(struct usb_serial *serial) |
620 | { | 620 | { |
621 | struct cypress_private *priv; | 621 | struct cypress_private *priv; |
622 | 622 | ||
@@ -629,7 +629,6 @@ static void cypress_shutdown(struct usb_serial *serial) | |||
629 | if (priv) { | 629 | if (priv) { |
630 | cypress_buf_free(priv->buf); | 630 | cypress_buf_free(priv->buf); |
631 | kfree(priv); | 631 | kfree(priv); |
632 | usb_set_serial_port_data(serial->port[0], NULL); | ||
633 | } | 632 | } |
634 | } | 633 | } |
635 | 634 | ||