]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
3.0-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 23 Feb 2013 01:15:08 +0000 (17:15 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 23 Feb 2013 01:15:08 +0000 (17:15 -0800)
added patches:
tty-set_termios-set_termiox-should-not-return-eintr.patch

queue-3.0/series
queue-3.0/tty-set_termios-set_termiox-should-not-return-eintr.patch [new file with mode: 0644]

index a61b1d2bb8a3e66b67d32fcddafe656353a2940b..30027c835c8aa55713e73a299321466302af60e5 100644 (file)
@@ -6,3 +6,4 @@ posix-cpu-timers-fix-nanosleep-task_struct-leak.patch
 hrtimer-prevent-hrtimer_enqueue_reprogram-race.patch
 alsa-ali5451-remove-irq-enabling-in-pointer-callback.patch
 alsa-rme32.c-irq-enabling-after-spin_lock_irq.patch
+tty-set_termios-set_termiox-should-not-return-eintr.patch
diff --git a/queue-3.0/tty-set_termios-set_termiox-should-not-return-eintr.patch b/queue-3.0/tty-set_termios-set_termiox-should-not-return-eintr.patch
new file mode 100644 (file)
index 0000000..aaeef66
--- /dev/null
@@ -0,0 +1,77 @@
+From 183d95cdd834381c594d3aa801c1f9f9c0c54fa9 Mon Sep 17 00:00:00 2001
+From: Oleg Nesterov <oleg@redhat.com>
+Date: Tue, 29 Jan 2013 20:07:41 +0100
+Subject: tty: set_termios/set_termiox should not return -EINTR
+
+From: Oleg Nesterov <oleg@redhat.com>
+
+commit 183d95cdd834381c594d3aa801c1f9f9c0c54fa9 upstream.
+
+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>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/tty/tty_ioctl.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/tty/tty_ioctl.c
++++ b/drivers/tty/tty_ioctl.c
+@@ -617,7 +617,7 @@ static int set_termios(struct tty_struct
+       if (opt & TERMIOS_WAIT) {
+               tty_wait_until_sent(tty, 0);
+               if (signal_pending(current))
+-                      return -EINTR;
++                      return -ERESTARTSYS;
+       }
+       tty_set_termios(tty, &tmp_termios);
+@@ -684,7 +684,7 @@ static int set_termiox(struct tty_struct
+       if (opt & TERMIOS_WAIT) {
+               tty_wait_until_sent(tty, 0);
+               if (signal_pending(current))
+-                      return -EINTR;
++                      return -ERESTARTSYS;
+       }
+       mutex_lock(&tty->termios_mutex);