--- drivers/char/tty_io_orig.c 2008-10-10 05:37:30.000000000 +0200 +++ drivers/char/tty_io.c 2008-10-12 13:37:11.000000000 +0200 @@ -2524,27 +2524,26 @@ int tty_do_resize(struct tty_struct *tty /* For a PTY we need to lock the tty side */ mutex_lock(&real_tty->termios_mutex); - if (!memcmp(ws, &tty->winsize, sizeof(*ws))) - goto done; - /* Get the PID values and reference them so we can - avoid holding the tty ctrl lock while sending signals */ - spin_lock_irqsave(&tty->ctrl_lock, flags); - pgrp = get_pid(tty->pgrp); - rpgrp = get_pid(real_tty->pgrp); - spin_unlock_irqrestore(&tty->ctrl_lock, flags); + flags = memcmp(ws, &real_tty->winsize, sizeof(*ws)); + real_tty->winsize = *ws; + mutex_unlock(&real_tty->termios_mutex); + if (flags){ + /* Get the PID values and reference them so we can + avoid holding the tty ctrl lock while sending signals */ + spin_lock_irqsave(&tty->ctrl_lock, flags); + pgrp = get_pid(tty->pgrp); + rpgrp = get_pid(real_tty->pgrp); + spin_unlock_irqrestore(&tty->ctrl_lock, flags); - if (pgrp) - kill_pgrp(pgrp, SIGWINCH, 1); - if (rpgrp != pgrp && rpgrp) - kill_pgrp(rpgrp, SIGWINCH, 1); + if (pgrp) + kill_pgrp(pgrp, SIGWINCH, 1); + if (rpgrp != pgrp && rpgrp) + kill_pgrp(rpgrp, SIGWINCH, 1); - put_pid(pgrp); - put_pid(rpgrp); + put_pid(pgrp); + put_pid(rpgrp); + } - tty->winsize = *ws; - real_tty->winsize = *ws; -done: - mutex_unlock(&real_tty->termios_mutex); return 0; } @@ -2996,7 +2995,7 @@ long tty_ioctl(struct file *file, unsign case TIOCSTI: return tiocsti(tty, p); case TIOCGWINSZ: - return tiocgwinsz(tty, p); + return tiocgwinsz(real_tty, p); case TIOCSWINSZ: return tiocswinsz(tty, real_tty, p); case TIOCCONS: