aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/tty_io.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index fd182f2e4a6c..eda27899372c 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -2909,15 +2909,16 @@ static int tty_fasync(int fd, struct file *filp, int on)
2909{ 2909{
2910 struct tty_struct *tty; 2910 struct tty_struct *tty;
2911 unsigned long flags; 2911 unsigned long flags;
2912 int retval; 2912 int retval = 0;
2913 2913
2914 lock_kernel();
2914 tty = (struct tty_struct *)filp->private_data; 2915 tty = (struct tty_struct *)filp->private_data;
2915 if (tty_paranoia_check(tty, filp->f_path.dentry->d_inode, "tty_fasync")) 2916 if (tty_paranoia_check(tty, filp->f_path.dentry->d_inode, "tty_fasync"))
2916 return 0; 2917 goto out;
2917 2918
2918 retval = fasync_helper(fd, filp, on, &tty->fasync); 2919 retval = fasync_helper(fd, filp, on, &tty->fasync);
2919 if (retval <= 0) 2920 if (retval <= 0)
2920 return retval; 2921 goto out;
2921 2922
2922 if (on) { 2923 if (on) {
2923 enum pid_type type; 2924 enum pid_type type;
@@ -2935,12 +2936,15 @@ static int tty_fasync(int fd, struct file *filp, int on)
2935 spin_unlock_irqrestore(&tty->ctrl_lock, flags); 2936 spin_unlock_irqrestore(&tty->ctrl_lock, flags);
2936 retval = __f_setown(filp, pid, type, 0); 2937 retval = __f_setown(filp, pid, type, 0);
2937 if (retval) 2938 if (retval)
2938 return retval; 2939 goto out;
2939 } else { 2940 } else {
2940 if (!tty->fasync && !waitqueue_active(&tty->read_wait)) 2941 if (!tty->fasync && !waitqueue_active(&tty->read_wait))
2941 tty->minimum_to_wake = N_TTY_BUF_SIZE; 2942 tty->minimum_to_wake = N_TTY_BUF_SIZE;
2942 } 2943 }
2943 return 0; 2944 retval = 0;
2945out:
2946 unlock_kernel();
2947 return retval;
2944} 2948}
2945 2949
2946/** 2950/**