summaryrefslogtreecommitdiff
path: root/drivers/tty/tty_io.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-12-07 10:19:31 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-12-07 10:19:31 +0100
commitba3b8bb1263dfb87914ef0ccf5f3a78604b3686b (patch)
tree142b9e56d8cae8f2c5514582bd767470a2b4147e /drivers/tty/tty_io.c
parente0efb3168d34dc8c8c72718672b8902e40efff8f (diff)
parent0477e92881850d44910a7e94fc2c46f96faa131f (diff)
Merge 5.10-rc7 into tty-next
We want the tty fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/tty_io.c')
-rw-r--r--drivers/tty/tty_io.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index c8cbb6bf3932..8034489337d7 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -2899,10 +2899,14 @@ void __do_SAK(struct tty_struct *tty)
struct task_struct *g, *p;
struct pid *session;
int i;
+ unsigned long flags;
if (!tty)
return;
- session = tty->session;
+
+ spin_lock_irqsave(&tty->ctrl_lock, flags);
+ session = get_pid(tty->session);
+ spin_unlock_irqrestore(&tty->ctrl_lock, flags);
tty_ldisc_flush(tty);
@@ -2934,6 +2938,7 @@ void __do_SAK(struct tty_struct *tty)
task_unlock(p);
} while_each_thread(g, p);
read_unlock(&tasklist_lock);
+ put_pid(session);
#endif
}