• Alan Cox's avatar
    tty: isicom: fix deadlock on shutdown · 2493c0c1
    Alan Cox authored
    Alexander Strakh <strakh@ispras.ru> reported
    
    	KERNEL_VERSION: 2.6.31
    	DESCRIBE:
    Driver drivers/char/isicom.c might sleep in atomic  context, because it
    calls 
    tty_port_xmit_buf under spin_lock.
    
    ./drivers/char/isicom.c:
    1307 static void isicom_hangup(struct tty_struct *tty)
    1308 {
    ...
    1315         spin_lock_irqsave(&port->card->card_lock, flags);
    1316         isicom_shutdown_port(port);
    ...
    
    Path to might_sleep macro from isicom_hangup:
    1. isicom_hangup calls spin_lock_irqsave (drivers/char/isicom.c:1315) and
    then 
    calls isicom_shutdown_port.
    2. isiscom_shutdown_port calls tty_port_free_xmit_buf at 
    drivers/char/isicom.c:906
    3. tty_port_free_xmit_buf calls mutex_lock at drivers/char/tty_port:48
    
    Found by Linux Driver Verification Project.
    Reported-by: default avatarAlexander Strakh <strakh@ispras.ru>
    Signed-off-by: default avatarAlan Cox <alan@linux.intel.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
    2493c0c1
isicom.c 41.2 KB