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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1329685723-14963-1-git-send-email-jslaby@suse.cz>
Date:	Sun, 19 Feb 2012 22:08:43 +0100
From:	Jiri Slaby <jslaby@...e.cz>
To:	gregkh@...e.de
Cc:	linux-kernel@...r.kernel.org,
	Sasha Levin <levinsasha928@...il.com>, jirislaby@...il.com
Subject: [PATCH 1/1] TTY: fix PTY hangup vs close race

Commit d3bda5298 (TTY: get rid of BTM around devpts_*) moved
devpts_pty_kill out of BTM, but the BTM was not protecting only
devpts_pty_kill, but also tty->link. Hence move the function back at
this late stage until this gets resolved properly some time later.

I was confused by tty_vhangup(tty->link) outside BTM. But inside of
tty_vhangup, there is a check for tty == NULL. But we cannot add such
a check here. We have to have the tty and free the devpts node...

Signed-off-by: Jiri Slaby <jslaby@...e.cz>
Reported-by: Sasha Levin <levinsasha928@...il.com>
---
 drivers/tty/pty.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index fa1bd2e..95037aa 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -54,8 +54,9 @@ static void pty_close(struct tty_struct *tty, struct file *filp)
 	wake_up_interruptible(&tty->link->write_wait);
 	if (tty->driver->subtype == PTY_TYPE_MASTER) {
 		set_bit(TTY_OTHER_CLOSED, &tty->flags);
-		tty_unlock();
+		/* BTM protects tty->link here */
 		devpts_pty_kill(tty->link);
+		tty_unlock();
 		tty_vhangup(tty->link);
 		tty_lock();
 	}
-- 
1.7.9


--
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