Skip to content

Commit

Permalink
USB: CDC-ACM: fix poison/unpoison imbalance
Browse files Browse the repository at this point in the history
commit a8b3b51 upstream.

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.

Fixes: 6069e3e ("USB: cdc-acm: untangle a circular dependency between callback and softint")
Signed-off-by: Oliver Neukum <oneukum@suse.com>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210421074513.4327-1-oneukum@suse.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
oneukum authored and gregkh committed May 2, 2021
1 parent 41c44e1 commit ac4ebcb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/usb/class/cdc-acm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit ac4ebcb

Please sign in to comment.