• Johan Hovold's avatar
    USB: cdc-acm: fix write and resume race · 16142775
    Johan Hovold authored
    commit e144ed28 upstream.
    
    Fix race between write() and resume() due to improper locking that could
    lead to writes being reordered.
    
    Resume must be done atomically and susp_count be protected by the
    write_lock in order to prevent racing with write(). This could otherwise
    lead to writes being reordered if write() grabs the write_lock after
    susp_count is decremented, but before the delayed urb is submitted.
    
    Fixes: 11ea859d ("USB: additional power savings for cdc-acm devices
    that support remote wakeup")
    Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    [bwh: Backported to 3.2:
     - Adjust context
     - Move mutex_lock(acm->mutex) above acquisition of spinlocks]
    Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
    16142775
cdc-acm.c 45.9 KB