Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tty: Fix BKL taken under a spinlock bug introduced in the BKL split

The fasync path takes the BKL (it probably doesn't need to in fact)
while holding the file_list spinlock. You can't do that with the kernel
lock: it causes lock inversions and deadlocks.

Leave the BKL over that bit for the moment.

Identified by AKPM.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Acked-and-Tested-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Alan Cox and committed by
Linus Torvalds
6698e347 09cea96c

-2
-2
drivers/char/tty_io.c
··· 516 516 /* inuse_filps is protected by the single kernel lock */ 517 517 lock_kernel(); 518 518 check_tty_count(tty, "do_tty_hangup"); 519 - unlock_kernel(); 520 519 521 520 file_list_lock(); 522 521 /* This breaks for file handles being sent over AF_UNIX sockets ? */ ··· 530 531 } 531 532 file_list_unlock(); 532 533 533 - lock_kernel(); 534 534 tty_ldisc_hangup(tty); 535 535 536 536 read_lock(&tasklist_lock);