aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/symbolserial.c
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2009-06-02 11:53:55 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-06-16 00:44:47 -0400
commitf9c99bb8b3a1ec81af68d484a551307326c2e933 (patch)
tree9031ebe390ecd558d54ad484dde5ba66dcf823b7 /drivers/usb/serial/symbolserial.c
parentc706ebdfc8955b850e477255a8c0f93f9f14712d (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/symbolserial.c')
-rw-r--r--drivers/usb/serial/symbolserial.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/usb/serial/symbolserial.c b/drivers/usb/serial/symbolserial.c
index 8b07ebc6baeb..6157fac9366b 100644
--- a/drivers/usb/serial/symbolserial.c
+++ b/drivers/usb/serial/symbolserial.c
@@ -267,7 +267,7 @@ error:
267 return retval; 267 return retval;
268} 268}
269 269
270static void symbol_shutdown(struct usb_serial *serial) 270static void symbol_disconnect(struct usb_serial *serial)
271{ 271{
272 struct symbol_private *priv = usb_get_serial_data(serial); 272 struct symbol_private *priv = usb_get_serial_data(serial);
273 273
@@ -275,9 +275,16 @@ static void symbol_shutdown(struct usb_serial *serial)
275 275
276 usb_kill_urb(priv->int_urb); 276 usb_kill_urb(priv->int_urb);
277 usb_free_urb(priv->int_urb); 277 usb_free_urb(priv->int_urb);
278}
279
280static void symbol_release(struct usb_serial *serial)
281{
282 struct symbol_private *priv = usb_get_serial_data(serial);
283
284 dbg("%s", __func__);
285
278 kfree(priv->int_buffer); 286 kfree(priv->int_buffer);
279 kfree(priv); 287 kfree(priv);
280 usb_set_serial_data(serial, NULL);
281} 288}
282 289
283static struct usb_driver symbol_driver = { 290static struct usb_driver symbol_driver = {
@@ -299,7 +306,8 @@ static struct usb_serial_driver symbol_device = {
299 .attach = symbol_startup, 306 .attach = symbol_startup,
300 .open = symbol_open, 307 .open = symbol_open,
301 .close = symbol_close, 308 .close = symbol_close,
302 .shutdown = symbol_shutdown, 309 .disconnect = symbol_disconnect,
310 .release = symbol_release,
303 .throttle = symbol_throttle, 311 .throttle = symbol_throttle,
304 .unthrottle = symbol_unthrottle, 312 .unthrottle = symbol_unthrottle,
305}; 313};