* [PATCH] CDC-ACM: fix poison/unpoison imbalance
@ 2021-04-21 7:45 Oliver Neukum
2021-04-22 11:35 ` Stefan Agner
0 siblings, 1 reply; 2+ messages in thread
From: Oliver Neukum @ 2021-04-21 7:45 UTC (permalink / raw)
To: gregKH, linux-usb; +Cc: 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.
Fixes: 6069e3e927c8f ("USB: cdc-acm: untangle a circular dependency between callback and softint")
Signed-off-by: Oliver Neukum <oneukum@suse.com>
---
drivers/usb/class/cdc-acm.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 3fda1ec961d7..f5886c512fec 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -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);
--
2.26.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] CDC-ACM: fix poison/unpoison imbalance
2021-04-21 7:45 [PATCH] CDC-ACM: fix poison/unpoison imbalance Oliver Neukum
@ 2021-04-22 11:35 ` Stefan Agner
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Agner @ 2021-04-22 11:35 UTC (permalink / raw)
To: Oliver Neukum; +Cc: gregKH, linux-usb
On 2021-04-21 09:45, Oliver Neukum wrote:
> 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!
>
> Fixes: 6069e3e927c8f ("USB: cdc-acm: untangle a circular dependency
> between callback and softint")
> Signed-off-by: Oliver Neukum <oneukum@suse.com>
Tested-by: Stefan Agner <stefan@agner.ch>
--
Stefan
> ---
> drivers/usb/class/cdc-acm.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
> index 3fda1ec961d7..f5886c512fec 100644
> --- a/drivers/usb/class/cdc-acm.c
> +++ b/drivers/usb/class/cdc-acm.c
> @@ -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);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-04-22 11:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-21 7:45 [PATCH] CDC-ACM: fix poison/unpoison imbalance Oliver Neukum
2021-04-22 11:35 ` Stefan Agner
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.