mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
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 <[email protected]> Cc: Al Viro <[email protected]> Cc: Alan Cox <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Tavis Ormandy <[email protected]> Cc: Jeff Dike <[email protected]> Cc: Julien Tinnes <[email protected]> Cc: Matt Mackall <[email protected]> Cc: stable <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
18c576f950
commit
7036251180
1 changed files with 1 additions and 1 deletions
|
|
@ -1951,8 +1951,8 @@ static int tty_fasync(int fd, struct file *filp, int on)
|
|||
pid = task_pid(current);
|
||||
type = PIDTYPE_PID;
|
||||
}
|
||||
spin_unlock_irqrestore(&tty->ctrl_lock, flags);
|
||||
retval = __f_setown(filp, pid, type, 0);
|
||||
spin_unlock_irqrestore(&tty->ctrl_lock, flags);
|
||||
if (retval)
|
||||
goto out;
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in a new issue