CDC-ACM: fix poison/unpoison imbalance
Subsystems (2)
Oliver Neukum
maintainerPATCH 1/1 CDC-ACM: fix poison/unpoison imbalance
suspend() does its poisoning conditionally, resume() does it unconditionally. On a device with combined interfaces this will balance, on a device with two interfaces the counter will go negative and resubmission will fail.
Both actions need to be done conditionally.
--- drivers/usb/class/cdc-acm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/class/cdc-acm.c +2 -1
@@ -1634,12 +1634,13 @@ static int acm_resume(struct usb_interface *intf)struct urb *urb;int rv =0 ; -acm_unpoison_urbs (acm);spin_lock_irq (&acm->write_lock);if (--acm->susp_count) goto out; +acm_unpoison_urbs (acm); +if (tty_port_initialized (&acm->port)) { rv =usb_submit_urb (acm->ctrlurb,GFP_ATOMIC );
Signature · 1 line
2.26.2
Quoted 6 lines · Oliver Neukum
suspend()does its poisoning conditionally,resume()does it unconditionally. On a device with combined interfaces this will balance, on a device with two interfaces the counter will go negative and resubmission will fail.Both actions need to be done conditionally.
FWIW, this relates to the issue reported on the kernel bugzilla:
https://bugzilla.kernel.org/show_bug.cgi?id=212725
Thanks for addressing this!
Quoted 4 lines
Fixes 6069e3e927c8f ("USB: cdc-acm: untangle a circular dependencybetween callback and softint")
Signed-off-by Oliver Neukum <[email protected]>
--
Stefan
Quoted 22 lines
--- drivers/usb/class/cdc-acm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/usb/class/cdc-acm.c +2
-1@@ -1634,12 +1634,13 @@ static int acm_resume(struct usb_interface *intf)struct urb *urb;int rv =0 ; -acm_unpoison_urbs (acm);spin_lock_irq (&acm->write_lock);if (--acm->susp_count) goto out; +acm_unpoison_urbs (acm); +if (tty_port_initialized (&acm->port)) { rv =usb_submit_urb (acm->ctrlurb,GFP_ATOMIC );