]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blobdiff - drivers/tty/tty_io.c
Merge 5.10-rc7 into tty-next
[mirror_ubuntu-hirsute-kernel.git] / drivers / tty / tty_io.c
index c8cbb6bf3932899c57e1a40a56206a989f207c90..8034489337d75241b1a42d781839679446e83d82 100644 (file)
@@ -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
 }