aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hovold <jhovold@gmail.com>2013-03-19 04:21:06 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-03-21 18:59:01 -0400
commitcb25505fc604292c70fc02143fc102f54c8595f0 (patch)
treebc648be558cdcae4376ab51ca038653ad506b3c9
parentc93d81955005c2ac0ea072f88d376026208410e1 (diff)
USB: cdc-acm: fix device unregistration
Unregister tty device in disconnect as is required by the USB stack. By deferring unregistration to when the last tty reference is dropped, the parent interface device can get unregistered before the child resulting in broken hotplug events being generated when the tty is finally closed: KERNEL[2290.798128] remove /devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:3.1 (usb) KERNEL[2290.804589] remove /devices/pci0000:00/0000:00:1d.7/usb2/2-1 (usb) KERNEL[2294.554799] remove /2-1:3.1/tty/ttyACM0 (tty) The driver must deal with tty callbacks after disconnect by checking the disconnected flag. Specifically, further opens must be prevented and this is already implemented. Cc: stable <stable@vger.kernel.org> Cc: Oliver Neukum <oneukum@suse.de> Acked-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/class/cdc-acm.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index c125b61c2499..387dc6c8ad25 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -593,7 +593,6 @@ static void acm_port_destruct(struct tty_port *port)
593 593
594 dev_dbg(&acm->control->dev, "%s\n", __func__); 594 dev_dbg(&acm->control->dev, "%s\n", __func__);
595 595
596 tty_unregister_device(acm_tty_driver, acm->minor);
597 acm_release_minor(acm); 596 acm_release_minor(acm);
598 usb_put_intf(acm->control); 597 usb_put_intf(acm->control);
599 kfree(acm->country_codes); 598 kfree(acm->country_codes);
@@ -1426,6 +1425,8 @@ static void acm_disconnect(struct usb_interface *intf)
1426 1425
1427 stop_data_traffic(acm); 1426 stop_data_traffic(acm);
1428 1427
1428 tty_unregister_device(acm_tty_driver, acm->minor);
1429
1429 usb_free_urb(acm->ctrlurb); 1430 usb_free_urb(acm->ctrlurb);
1430 for (i = 0; i < ACM_NW; i++) 1431 for (i = 0; i < ACM_NW; i++)
1431 usb_free_urb(acm->wb[i].urb); 1432 usb_free_urb(acm->wb[i].urb);