Oleg Nesterov 183d95cdd8 tty: set_termios/set_termiox should not return -EINTR
See https://bugzilla.redhat.com/show_bug.cgi?id=904907
read command causes bash to abort with double free or corruption (out).

A simple test-case from Roman:

	// Compile the reproducer and send sigchld ti that process.
	// EINTR occurs even if SA_RESTART flag is set.

	void handler(int sig)
	{
	}

	main()
	{
	  struct sigaction act;
	  act.sa_handler = handler;
	  act.sa_flags = SA_RESTART;
	  sigaction (SIGCHLD, &act, 0);
	  struct termio ttp;
	  ioctl(0, TCGETA, &ttp);
	  while(1)
	  {
	    if (ioctl(0, TCSETAW, ttp) < 0)
	      {
		if (errno == EINTR)
		{
		  fprintf(stderr, "BUG!"); return(1);
		}
	      }
	  }
	}

Change set_termios/set_termiox to return -ERESTARTSYS to fix this
particular problem.

I didn't dare to change other EINTR's in drivers/tty/, but they look
equally wrong.

Reported-by: Roman Rakus <rrakus@redhat.com>
Reported-by: Lingzhu Xiang <lxiang@redhat.com>
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-04 15:02:14 -08:00
..
2013-01-15 22:43:15 -08:00
2013-01-15 22:30:15 -08:00
2013-01-15 22:30:15 -08:00
2013-01-21 15:30:08 -08:00
2013-01-21 15:30:08 -08:00
2013-01-15 22:43:15 -08:00
2013-01-15 22:30:15 -08:00
2011-03-31 11:26:23 -03:00
2013-01-30 12:10:09 +01:00
2012-08-10 12:55:47 -07:00
2013-01-15 22:43:16 -08:00
2013-01-25 13:27:36 -08:00
2013-01-20 15:50:36 -08:00
2012-11-15 17:20:58 -08:00