• Thilo-Alexander Ginkel's avatar
    usb: cdc-acm: Fix acm_tty_hangup() vs. acm_tty_close() race · f9fd8d62
    Thilo-Alexander Ginkel authored
    [Not upstream as it was fixed differently for 3.3 with a much more
    "intrusive" rework of the driver - gregkh]
    
    There is a race condition involving acm_tty_hangup() and acm_tty_close()
    where hangup() would attempt to access tty->driver_data without proper
    locking and NULL checking after close() has potentially already set it
    to NULL.  One possibility to (sporadically) trigger this behavior is to
    perform a suspend/resume cycle with a running WWAN data connection.
    
    This patch addresses the issue by introducing a NULL check for
    tty->driver_data in acm_tty_hangup() protected by open_mutex and exiting
    gracefully when hangup() is invoked on a device that has already been
    closed.
    Signed-off-by: default avatarThilo-Alexander Ginkel <thilo@ginkel.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
    f9fd8d62
cdc-acm.c 44.8 KB