tty: split the lock up a bit further
authorAlan Cox <alan@linux.intel.com>
Mon, 30 Nov 2009 13:18:51 +0000 (13:18 +0000)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 11 Dec 2009 23:18:08 +0000 (15:18 -0800)
The tty count sanity check may need the BKL, that isn't clear. However it
is clear that the count use of the lock is internal and independant of the
bigger use of the lock.

Furthermore the file list locking is also separately locked already

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/char/tty_io.c

index a19fef2..684f0e0 100644 (file)
@@ -516,6 +516,8 @@ static void do_tty_hangup(struct work_struct *work)
        /* inuse_filps is protected by the single kernel lock */
        lock_kernel();
        check_tty_count(tty, "do_tty_hangup");
+       unlock_kernel();
+
        file_list_lock();
        /* This breaks for file handles being sent over AF_UNIX sockets ? */
        list_for_each_entry(filp, &tty->tty_files, f_u.fu_list) {
@@ -529,6 +531,7 @@ static void do_tty_hangup(struct work_struct *work)
        }
        file_list_unlock();
 
+       lock_kernel();
        tty_ldisc_hangup(tty);
 
        read_lock(&tasklist_lock);