Skip to contentSkip to conversation

USB: serial: fix unthrottle races

PATCH New Johan Hovold 1 participant 1 message Apr 29, 2019 USB

lore
Share & tools
lore
#0 lore raw

PATCH 1/5 USB: serial: fix unthrottle races

Quoted 5 lines · Oliver Neukum
Quoted 4 lines · Johan Hovold
(quoted diff) +0 -0
@@ -484,6 +503,12 @@ void usb_serial_generic_unthrottle(struct tty_struct *tty)
        port->throttled = port->throttle_req = 0;
        spin_unlock_irq(&port->lock);
 
Quoted 12 lines

Review void usb_serial_generic_unthrottle(struct tty_struct *tty) · line 513

Quoted 8 lines
(quoted diff) +6 -0
+       /*
+        * Matches the smp_mb__after_atomic() in
+        * usb_serial_generic_read_bulk_callback().
+        */
+       smp_mb();
+
        if (was_throttled)
                usb_serial_generic_submit_read_urbs(port, GFP_KERNEL);

Doesn't the spin_unlock_irq() imply smp_mb()?
Otherwise it looks correct to me.

No, spin_unlock_irq() is only a one-way barrier, and doesn't prevent later accesses from "moving" into the locked section.

Johan