All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alan Stern <stern@rowland.harvard.edu>
To: Johan Hovold <johan@kernel.org>
Cc: Oliver Neukum <oneukum@suse.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	<linux-usb@vger.kernel.org>
Subject: Re: [PATCH 0/5] USB: fix tty unthrottle races
Date: Thu, 25 Apr 2019 16:58:20 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.44L0.1904251655590.1292-100000@iolanthe.rowland.org> (raw)
In-Reply-To: <20190425160540.10036-1-johan@kernel.org>

On Thu, 25 Apr 2019, Johan Hovold wrote:

> This series fixes a couple of long-standing issues in USB serial and
> cdc-acm which essentially share the same implementation.
> 
> As noted by Oliver a few years back, read-urb completion can race with
> unthrottle() running on another CPU and this can potentially lead to
> memory corruption. This particular bug in cdc-acm was unfortunately
> reintroduced a year later.
> 
> There's also a second race due to missing memory barriers which could
> theoretically lead to the port staying throttled until reopened on
> weakly ordered systems. A second set of memory barriers should address
> that.
> 
> I would appreciate your keen eyes on this one to make sure I got the
> barriers right.
> 
> I noticed there's some on-going discussion about the atomic memory
> barriers that Alan's involved in, and I'll try to catch up on his
> data-race work as well. I'm still a little concerned about whether the
> smp_mb__before_atomic() is sufficient to prevent the compiler from
> messing things up without adding READ_ONCE().

I think your changes in patches 1 and 4 are correct.  Regardless of the
issues still undergoing discussion elsewhere, smp_mb__before_atomic()
should cause both the compiler and the CPU to order every preceding
operation (READ_ONCE or not) before the atomic op.

Alan Stern

> Note that none of these have stable tags as the issues have been there
> for eight years or so without anyone noticing (besides Oliver).
> 
> Still feels good to clean up your own mess.
> 
> Note that the cdc-acm patches have so far only been compile tested.
> 
> Johan
> 
> 
> Johan Hovold (5):
>   USB: serial: fix unthrottle races
>   USB: serial: clean up throttle handling
>   USB: serial: generic: drop unnecessary goto
>   USB: cdc-acm: fix unthrottle races
>   USB: cdc-acm: clean up throttle handling
> 
>  drivers/usb/class/cdc-acm.c  | 63 +++++++++++++++---------------
>  drivers/usb/class/cdc-acm.h  |  3 +-
>  drivers/usb/serial/generic.c | 76 +++++++++++++++++++-----------------
>  include/linux/usb/serial.h   |  5 +--
>  4 files changed, 75 insertions(+), 72 deletions(-)
> 
> 


  parent reply	other threads:[~2019-04-25 20:58 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-25 16:05 [PATCH 0/5] USB: fix tty unthrottle races Johan Hovold
2019-04-25 16:05 ` [1/5] USB: serial: fix " Johan Hovold
2019-04-25 16:05   ` [PATCH 1/5] " Johan Hovold
2019-05-13 10:43   ` Johan Hovold
2019-05-13 10:56     ` Greg Kroah-Hartman
2019-05-13 11:46       ` Johan Hovold
2019-05-13 12:51         ` Greg Kroah-Hartman
2019-05-13 12:59           ` Johan Hovold
2019-05-14 12:53             ` Sasha Levin
2019-05-14 12:57               ` Johan Hovold
2019-04-25 20:58 ` Alan Stern [this message]
2019-04-26  4:55   ` [PATCH 0/5] USB: fix tty " Johan Hovold
2019-04-29  9:30 ` Johan Hovold
2019-04-25 16:05 [2/5] USB: serial: clean up throttle handling Johan Hovold
2019-04-25 16:05 ` [PATCH 2/5] " Johan Hovold
2019-04-25 16:05 [3/5] USB: serial: generic: drop unnecessary goto Johan Hovold
2019-04-25 16:05 ` [PATCH 3/5] " Johan Hovold
2019-04-25 16:05 [4/5] USB: cdc-acm: fix unthrottle races Johan Hovold
2019-04-25 16:05 ` [PATCH 4/5] " Johan Hovold
2019-04-25 16:05 [5/5] USB: cdc-acm: clean up throttle handling Johan Hovold
2019-04-25 16:05 ` [PATCH 5/5] " Johan Hovold
2019-04-29  9:50 [1/5] USB: serial: fix unthrottle races Oliver Neukum
2019-04-29  9:50 ` [PATCH 1/5] " Oliver Neukum
2019-04-29 10:03 [1/5] " Johan Hovold
2019-04-29 10:03 ` [PATCH 1/5] " Johan Hovold
2019-04-29 10:09 [4/5] USB: cdc-acm: " Oliver Neukum
2019-04-29 10:09 ` [PATCH 4/5] " Oliver Neukum
2019-04-29 10:10 [5/5] USB: cdc-acm: clean up throttle handling Oliver Neukum
2019-04-29 10:10 ` [PATCH 5/5] " Oliver Neukum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.44L0.1904251655590.1292-100000@iolanthe.rowland.org \
    --to=stern@rowland.harvard.edu \
    --cc=gregkh@linuxfoundation.org \
    --cc=johan@kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=oneukum@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.