aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/vt.c
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2008-04-30 03:53:30 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-30 11:29:40 -0400
commit47f86834bbd4193139d61d659bebf9ab9d691e37 (patch)
tree6724b07e24929eba5c6df31f07871d9d6b4aa296 /drivers/char/vt.c
parent04f378b198da233ca0aca341b113dc6579d46123 (diff)
redo locking of tty->pgrp
Historically tty->pgrp and friends were pid_t and the code "knew" they were safe. The change to pid structs opened up a few races and the removal of the BKL in places made them quite hittable. We put tty->pgrp under the ctrl_lock for the tty. Signed-off-by: Alan Cox <alan@redhat.com> Cc: Oleg Nesterov <oleg@tv-sign.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/vt.c')
-rw-r--r--drivers/char/vt.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/char/vt.c b/drivers/char/vt.c
index e64f0bf3624e..c71d1d0f13b9 100644
--- a/drivers/char/vt.c
+++ b/drivers/char/vt.c
@@ -909,15 +909,21 @@ int vc_resize(struct vc_data *vc, unsigned int cols, unsigned int lines)
909 909
910 if (vc->vc_tty) { 910 if (vc->vc_tty) {
911 struct winsize ws, *cws = &vc->vc_tty->winsize; 911 struct winsize ws, *cws = &vc->vc_tty->winsize;
912 unsigned long flags;
912 913
913 memset(&ws, 0, sizeof(ws)); 914 memset(&ws, 0, sizeof(ws));
914 ws.ws_row = vc->vc_rows; 915 ws.ws_row = vc->vc_rows;
915 ws.ws_col = vc->vc_cols; 916 ws.ws_col = vc->vc_cols;
916 ws.ws_ypixel = vc->vc_scan_lines; 917 ws.ws_ypixel = vc->vc_scan_lines;
918
919 mutex_lock(&vc->vc_tty->termios_mutex);
920 spin_lock_irqsave(&vc->vc_tty->ctrl_lock, flags);
917 if ((ws.ws_row != cws->ws_row || ws.ws_col != cws->ws_col) && 921 if ((ws.ws_row != cws->ws_row || ws.ws_col != cws->ws_col) &&
918 vc->vc_tty->pgrp) 922 vc->vc_tty->pgrp)
919 kill_pgrp(vc->vc_tty->pgrp, SIGWINCH, 1); 923 kill_pgrp(vc->vc_tty->pgrp, SIGWINCH, 1);
924 spin_unlock_irqrestore(&vc->vc_tty->ctrl_lock, flags);
920 *cws = ws; 925 *cws = ws;
926 mutex_unlock(&vc->vc_tty->termios_mutex);
921 } 927 }
922 928
923 if (CON_IS_VISIBLE(vc)) 929 if (CON_IS_VISIBLE(vc))