USB: fix tty unthrottle races
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest5 patches 10 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/5 | USB: serial: fix unthrottle racesdrivers/ | +32 | 7 replies | |
| 2/5 | USB: serial: clean up throttle handlingdrivers/ include/ | +9 | 0 replies | |
| 3/5 | USB: serial: generic: drop unnecessary gotodrivers/ | +1 | 0 replies | |
| 4/5 | USB: cdc-acm: fix unthrottle racesdrivers/ | +25 | 0 replies | |
| 5/5 | USB: cdc-acm: clean up throttle handlingdrivers/ drivers/ | +9 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/5] USB: fix tty unthrottle races
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().
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(-)
Signature · 1 line
2.21.0