Files
ubports_kernel_google_msm/include/linux
Jiri Slaby acfa747baf TTY: open/hangup race fixup
Like in the "TTY: don't allow reopen when ldisc is changing" patch,
this one fixes a TTY WARNING as described in the option 1) there:
1) __tty_hangup from tty_ldisc_hangup to tty_ldisc_enable. During this
section tty_lock is held. However tty_lock is temporarily dropped in
the middle of the function by tty_ldisc_hangup.

The fix is to introduce a new flag which we set during the unlocked
window and check it in tty_reopen too. The flag is TTY_HUPPING and is
cleared after TTY_HUPPED is set.

While at it, remove duplicate TTY_HUPPED set_bit. The one after
calling ops->hangup seems to be more correct. But anyway, we hold
tty_lock, so there should be no difference.

Also document the function it does that kind of crap.

Nicely reproducible with two forked children:
static void do_work(const char *tty)
{
	if (signal(SIGHUP, SIG_IGN) == SIG_ERR) exit(1);
	setsid();
	while (1) {
		int fd = open(tty, O_RDWR|O_NOCTTY);
		if (fd < 0) continue;
		if (ioctl(fd, TIOCSCTTY)) continue;
		if (vhangup()) continue;
		close(fd);
	}
	exit(0);
}

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Reported-by: <Valdis.Kletnieks@vt.edu>
Reported-by: Kyle McMartin <kyle@mcmartin.ca>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-11-29 14:52:48 -08:00
..
2010-10-30 08:31:35 -07:00
2010-10-26 14:51:00 -04:00
2010-10-30 08:45:43 -04:00
2010-11-10 14:54:09 +01:00
2010-11-10 14:54:09 +01:00
2010-11-10 14:54:09 +01:00
2010-10-25 21:18:20 -04:00
2010-10-25 08:02:40 -07:00
2010-10-22 15:55:22 +02:00
2010-10-21 14:47:59 +02:00
2010-10-28 17:22:16 -04:00
2010-10-25 14:11:37 -07:00
2010-10-23 22:49:32 +02:00
2010-11-15 22:40:38 +01:00
2010-11-15 22:40:38 +01:00
2010-10-26 16:52:08 -07:00
2010-10-28 17:22:13 -04:00
2010-10-22 15:34:12 -05:00
2010-11-12 07:55:32 -08:00
2010-10-21 21:18:54 -04:00
2010-10-25 21:24:15 -04:00
2010-10-28 09:08:47 -05:00
2010-10-26 16:52:05 -07:00
2010-10-24 15:07:11 -07:00
2010-11-12 07:55:32 -08:00
2010-10-29 04:16:31 -04:00
2010-10-25 21:18:20 -04:00
2010-10-27 18:03:16 -07:00
2010-10-30 12:12:50 +02:00
2010-10-20 03:02:23 -07:00
2010-10-21 15:44:13 +02:00
2010-10-27 17:28:36 +01:00
2010-10-21 04:11:07 -07:00
2010-10-22 10:20:04 -07:00
2010-11-29 14:52:48 -08:00
2010-10-26 16:52:03 -07:00
2010-10-22 10:16:43 -07:00
2010-11-08 12:28:32 -08:00
2010-10-26 16:52:14 -07:00