tty: Push the bkl down a bit in the hangup code
authorAlan Cox <alan@linux.intel.com>
Mon, 30 Nov 2009 13:18:40 +0000 (13:18 +0000)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 11 Dec 2009 23:18:08 +0000 (15:18 -0800)
We know that the redirect field is handled via its own locking in all
places

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

index c408c81c06a0967fb62f1d8905af5bb93cf8fdb0..cc941a3504d755c7aa02ed1d53d89d2db5d6a1a3 100644 (file)
@@ -505,8 +505,6 @@ static void do_tty_hangup(struct work_struct *work)
        if (!tty)
                return;
 
-       /* inuse_filps is protected by the single kernel lock */
-       lock_kernel();
 
        spin_lock(&redirect_lock);
        if (redirect && redirect->private_data == tty) {
@@ -515,6 +513,8 @@ static void do_tty_hangup(struct work_struct *work)
        }
        spin_unlock(&redirect_lock);
 
+       /* inuse_filps is protected by the single kernel lock */
+       lock_kernel();
        check_tty_count(tty, "do_tty_hangup");
        file_list_lock();
        /* This breaks for file handles being sent over AF_UNIX sockets ? */