]> err.no Git - linux-2.6/commitdiff
tty_io: fasync BKL pushdown
authorJonathan Corbet <corbet@lwn.net>
Thu, 19 Jun 2008 22:04:53 +0000 (16:04 -0600)
committerJonathan Corbet <corbet@lwn.net>
Wed, 2 Jul 2008 21:06:27 +0000 (15:06 -0600)
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
drivers/char/tty_io.c

index fd182f2e4a6cf0c030ae85b3cd4e3bccba6ff441..eda27899372c99c9ac43bbd186690b59151b4f57 100644 (file)
@@ -2909,15 +2909,16 @@ static int tty_fasync(int fd, struct file *filp, int on)
 {
        struct tty_struct *tty;
        unsigned long flags;
-       int retval;
+       int retval = 0;
 
+       lock_kernel();
        tty = (struct tty_struct *)filp->private_data;
        if (tty_paranoia_check(tty, filp->f_path.dentry->d_inode, "tty_fasync"))
-               return 0;
+               goto out;
 
        retval = fasync_helper(fd, filp, on, &tty->fasync);
        if (retval <= 0)
-               return retval;
+               goto out;
 
        if (on) {
                enum pid_type type;
@@ -2935,12 +2936,15 @@ static int tty_fasync(int fd, struct file *filp, int on)
                spin_unlock_irqrestore(&tty->ctrl_lock, flags);
                retval = __f_setown(filp, pid, type, 0);
                if (retval)
-                       return retval;
+                       goto out;
        } else {
                if (!tty->fasync && !waitqueue_active(&tty->read_wait))
                        tty->minimum_to_wake = N_TTY_BUF_SIZE;
        }
-       return 0;
+       retval = 0;
+out:
+       unlock_kernel();
+       return retval;
 }
 
 /**