Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tty: fix read of tty->pgrp outside of ctrl_lock

The intention was clearly to use the tty_pgrp local variable rather than
re-read tty->pgrp outside of ctrl_lock, so do that.

This bug was introduced by commit 2812d9e9fd94 ("tty: Combine
SIGTTOU/SIGTTIN handling").

Signed-off-by: David Emett <dave@sp4m.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

David Emett and committed by
Greg Kroah-Hartman
cf90c06f 3adf2aa8

+1 -1
+1 -1
drivers/tty/tty_jobctrl.c
··· 44 44 tty_pgrp = tty->pgrp; 45 45 spin_unlock_irqrestore(&tty->ctrl_lock, flags); 46 46 47 - if (tty_pgrp && pgrp != tty->pgrp) { 47 + if (tty_pgrp && pgrp != tty_pgrp) { 48 48 if (is_ignored(sig)) { 49 49 if (sig == SIGTTIN) 50 50 ret = -EIO;