• Arnd Bergmann's avatar
    tty: reorder ldisc locking · 60af22d2
    Arnd Bergmann authored
    We need to release the BTM in paste_selection() when
    sleeping in tty_ldisc_ref_wait to avoid deadlocks
    with tty_ldisc_enable.
    
    In tty_set_ldisc, we now always grab the BTM before
    taking the ldisc_mutex in order to avoid AB-BA
    deadlocks between the two.
    
    tty_ldisc_halt potentially blocks on a workqueue
    function that takes the BTM, so we must release
    the BTM before calling it.
    Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
    Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
    60af22d2
tty_ldisc.c 22 KB