tty: TIOCGSOFTCAR/SSOFTCAR on pty is wron
authorAlan Cox <alan@lxorguk.ukuu.org.uk>
Tue, 26 Aug 2008 18:52:47 +0000 (19:52 +0100)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 27 Aug 2008 21:37:09 +0000 (14:37 -0700)
The termios settings ioctls on a pty should affect the bound tty side not
the pty. The SOFTCAR ioctls use the wrong device file.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/char/tty_ioctl.c

index ea9fc5d03b991d924761a12a74b029546629d4a3..bf34e45974212fc46df349416646779d2e7d78dd 100644 (file)
@@ -937,12 +937,14 @@ int tty_mode_ioctl(struct tty_struct *tty, struct file *file,
                        return 0;
 #endif
        case TIOCGSOFTCAR:
-               return put_user(C_CLOCAL(tty) ? 1 : 0,
+               /* FIXME: for correctness we may need to take the termios
+                  lock here - review */
+               return put_user(C_CLOCAL(real_tty) ? 1 : 0,
                                                (int __user *)arg);
        case TIOCSSOFTCAR:
                if (get_user(arg, (unsigned int __user *) arg))
                        return -EFAULT;
-               return tty_change_softcar(tty, arg);
+               return tty_change_softcar(real_tty, arg);
        default:
                return -ENOIOCTLCMD;
        }