login
Header Space

 
 

Re: [PATCH] powerpc: add new required termio functions

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Linus Torvalds <torvalds@...>
Cc: Michael Neuling <mikey@...>, <linux-kernel@...>, <linuxppc-dev@...>, <paulus@...>, Alan Cox <alan@...>, <akpm@...>, David S. Miller <davem@...>
Date: Tuesday, September 11, 2007 - 10:33 pm

On Tue, Sep 11, 2007 at 07:17:42PM -0700, Linus Torvalds wrote:
 

As far as I can see TIOCSLCKTRMIOS and TIOCGLCKTRMIOS aren't protected
by TCGETS2 guards.  Do they need to be ...  Perhaps


From: Tony Breeds <tony@bakeyournoodle.com>

Add Guards around TIOCSLCKTRMIOS and TIOCGLCKTRMIOS.

Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>

---

 drivers/char/tty_ioctl.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/drivers/char/tty_ioctl.c b/drivers/char/tty_ioctl.c
index 4a8969c..3ee73cf 100644
--- a/drivers/char/tty_ioctl.c
+++ b/drivers/char/tty_ioctl.c
@@ -795,6 +795,19 @@ int n_tty_ioctl(struct tty_struct * tty, struct file * file,
 			if (L_ICANON(tty))
 				retval = inq_canon(tty);
 			return put_user(retval, (unsigned int __user *) arg);
+#ifndef TCGETS2
+		case TIOCGLCKTRMIOS:
+			if (kernel_termios_to_user_termios((struct termios __user *)arg, real_tty->termios_locked))
+				return -EFAULT;
+			return 0;
+
+		case TIOCSLCKTRMIOS:
+			if (!capable(CAP_SYS_ADMIN))
+				return -EPERM;
+			if (user_termios_to_kernel_termios(real_tty->termios_locked, (struct termios __user *) arg))
+				return -EFAULT;
+			return 0;
+#else
 		case TIOCGLCKTRMIOS:
 			if (kernel_termios_to_user_termios_1((struct termios __user *)arg, real_tty->termios_locked))
 				return -EFAULT;
@@ -806,6 +819,7 @@ int n_tty_ioctl(struct tty_struct * tty, struct file * file,
 			if (user_termios_to_kernel_termios_1(real_tty->termios_locked, (struct termios __user *) arg))
 				return -EFAULT;
 			return 0;
+#endif
 
 		case TIOCPKT:
 		{

Yours Tony

  linux.conf.au        http://linux.conf.au/ || http://lca2008.linux.org.au/
  Jan 28 - Feb 02 2008 The Australian Linux Technical Conference!

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] powerpc: add new required termio functions, Michael Neuling, (Tue Sep 11, 10:04 pm)
Re: [PATCH] powerpc: add new required termio functions, Heiko Carstens, (Wed Sep 12, 6:20 am)
Re: [PATCH] powerpc: add new required termio functions, Andrew Morton, (Wed Sep 12, 7:01 am)
Re: [PATCH] powerpc: add new required termio functions, Christoph Hellwig, (Wed Sep 12, 7:34 am)
Re: [PATCH] powerpc: add new required termio functions, Heiko Carstens, (Wed Sep 12, 7:52 am)
Re: [PATCH] powerpc: add new required termio functions, Christoph Hellwig, (Wed Sep 12, 9:49 am)
Re: [PATCH] powerpc: add new required termio functions , Michael Neuling, (Wed Sep 12, 7:16 am)
Re: [PATCH] powerpc: add new required termio functions, Geoff Levand, (Tue Sep 11, 10:19 pm)
Re: [PATCH] powerpc: add new required termio functions, Linus Torvalds, (Tue Sep 11, 10:17 pm)
Re: [PATCH] powerpc: add new required termio functions , Michael Neuling, (Tue Sep 11, 10:34 pm)
Re: [PATCH] powerpc: add new required termio functions, Tony Breeds, (Tue Sep 11, 10:33 pm)
speck-geostationary