lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Fri,  8 Aug 2008 18:36:18 +0800
From:	Kanru Chen <koster@...ian.org.tw>
To:	linux-kernel@...r.kernel.org
Cc:	alan@...rguk.ukuu.org.uk, Kanru Chen <koster@...ian.org.tw>
Subject: [PATCH] tty_io: fix tiocswinsz, tiocgwinsz races.

real_tty may receive SIGWINCH before the new winsize is setted.

Signed-off-by: Kanru Chen <koster@...ian.org.tw>
---
 drivers/char/tty_io.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index e1b46bc..63703ea 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -2523,6 +2523,8 @@ static int tiocswinsz(struct tty_struct *tty, struct tty_struct *real_tty,
 		return -EFAULT;
 
 	mutex_lock(&tty->termios_mutex);
+	if (real_tty != tty)
+		mutex_lock(&real_tty->termios_mutex);
 	if (!memcmp(&tmp_ws, &tty->winsize, sizeof(*arg)))
 		goto done;
 
@@ -2553,6 +2555,8 @@ static int tiocswinsz(struct tty_struct *tty, struct tty_struct *real_tty,
 	tty->winsize = tmp_ws;
 	real_tty->winsize = tmp_ws;
 done:
+	if (real_tty != tty)
+		mutex_unlock(&real_tty->termios_mutex);
 	mutex_unlock(&tty->termios_mutex);
 	return 0;
 }
-- 
1.5.6.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ