• Romain Izard's avatar
    usb: cdc-acm: fix race during wakeup blocking TX traffic · 2392ffab
    Romain Izard authored
    commit 93e1c8a6 upstream.
    
    When the kernel is compiled with preemption enabled, the URB completion
    handler can run in parallel with the work responsible for waking up the
    tty layer. If the URB handler sets the EVENT_TTY_WAKEUP bit during the
    call to tty_port_tty_wakeup() to signal that there is room for additional
    input, it will be cleared at the end of this call. As a result, TX traffic
    on the upper layer will be blocked.
    
    This can be seen with a kernel configured with CONFIG_PREEMPT, and a fast
    modem connected with PPP running over a USB CDC-ACM port.
    
    Use test_and_clear_bit() instead, which ensures that each wakeup requested
    by the URB completion code will trigger a call to tty_port_tty_wakeup().
    
    Fixes: 1aba579f cdc-acm: handle read pipe errors
    Signed-off-by: default avatarRomain Izard <romain.izard.pro@gmail.com>
    Cc: stable <stable@vger.kernel.org>
    Acked-by: default avatarOliver Neukum <oneukum@suse.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    2392ffab
cdc-acm.c 52.8 KB