diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2009-12-17 10:07:19 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-01-20 18:03:31 -0500 |
commit | 703625118069f9f8960d356676662d3db5a9d116 (patch) | |
tree | fe46ee6784dee41dbb9b642a1f551a1adfa44710 /drivers | |
parent | 18c576f950167ff3ec1e56dcbbec7b87288b3237 (diff) |
tty: fix race in tty_fasync
We need to keep the lock held over the call to __f_setown() to
prevent a PID race.
Thanks to Al Viro for pointing out the problem, and to Travis for
making us look here in the first place.
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Tavis Ormandy <taviso@google.com>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Julien Tinnes <jln@google.com>
Cc: Matt Mackall <mpm@selenic.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/char/tty_io.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index f15df40bc318..c6f3b48be9dd 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
@@ -1951,8 +1951,8 @@ static int tty_fasync(int fd, struct file *filp, int on) | |||
1951 | pid = task_pid(current); | 1951 | pid = task_pid(current); |
1952 | type = PIDTYPE_PID; | 1952 | type = PIDTYPE_PID; |
1953 | } | 1953 | } |
1954 | spin_unlock_irqrestore(&tty->ctrl_lock, flags); | ||
1955 | retval = __f_setown(filp, pid, type, 0); | 1954 | retval = __f_setown(filp, pid, type, 0); |
1955 | spin_unlock_irqrestore(&tty->ctrl_lock, flags); | ||
1956 | if (retval) | 1956 | if (retval) |
1957 | goto out; | 1957 | goto out; |
1958 | } else { | 1958 | } else { |