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/spcp8x5.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/spcp8x5.c')
-rw-r--r-- | drivers/usb/serial/spcp8x5.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c index 8f7ed8f13996..3c249d8e8b8e 100644 --- a/drivers/usb/serial/spcp8x5.c +++ b/drivers/usb/serial/spcp8x5.c | |||
@@ -356,7 +356,7 @@ cleanup: | |||
356 | } | 356 | } |
357 | 357 | ||
358 | /* call when the device plug out. free all the memory alloced by probe */ | 358 | /* call when the device plug out. free all the memory alloced by probe */ |
359 | static void spcp8x5_shutdown(struct usb_serial *serial) | 359 | static void spcp8x5_release(struct usb_serial *serial) |
360 | { | 360 | { |
361 | int i; | 361 | int i; |
362 | struct spcp8x5_private *priv; | 362 | struct spcp8x5_private *priv; |
@@ -366,7 +366,6 @@ static void spcp8x5_shutdown(struct usb_serial *serial) | |||
366 | if (priv) { | 366 | if (priv) { |
367 | free_ringbuf(priv->buf); | 367 | free_ringbuf(priv->buf); |
368 | kfree(priv); | 368 | kfree(priv); |
369 | usb_set_serial_port_data(serial->port[i] , NULL); | ||
370 | } | 369 | } |
371 | } | 370 | } |
372 | } | 371 | } |
@@ -1020,7 +1019,7 @@ static struct usb_serial_driver spcp8x5_device = { | |||
1020 | .write_bulk_callback = spcp8x5_write_bulk_callback, | 1019 | .write_bulk_callback = spcp8x5_write_bulk_callback, |
1021 | .chars_in_buffer = spcp8x5_chars_in_buffer, | 1020 | .chars_in_buffer = spcp8x5_chars_in_buffer, |
1022 | .attach = spcp8x5_startup, | 1021 | .attach = spcp8x5_startup, |
1023 | .shutdown = spcp8x5_shutdown, | 1022 | .release = spcp8x5_release, |
1024 | }; | 1023 | }; |
1025 | 1024 | ||
1026 | static int __init spcp8x5_init(void) | 1025 | static int __init spcp8x5_init(void) |