]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
tty: Support compat_ioctl get/set termios_locked
authorThomas Meyer <thomas@m3y3r.de>
Wed, 5 Oct 2011 21:13:13 +0000 (23:13 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 18 Oct 2011 21:17:11 +0000 (14:17 -0700)
When running a Fedora 15 (x86) on an x86_64 kernel, in the boot process
plymouthd complains about those two missing ioctls:
[    2.581783] ioctl32(plymouthd:186): Unknown cmd fd(10) cmd(00005457){t:'T';sz:0} arg(ffb6a5d0) on /dev/tty1
[    2.581803] ioctl32(plymouthd:186): Unknown cmd fd(10) cmd(00005456){t:'T';sz:0} arg(ffb6a680) on /dev/tty1

both ioctl functions work on the 'struct termios' resp. 'struct termios2',
which has the same size (36 bytes resp. 44 bytes) on x86 and x86_64,
so it's just a matter of converting the pointer from userland.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/tty/tty_io.c
drivers/tty/tty_ioctl.c
include/linux/tty.h

index 150e4f747c7dc4bc822a706a76d06afefb80424d..4ca4bcd28ff74081d6a882c2f18b9a3995af3474 100644 (file)
@@ -2717,6 +2717,8 @@ static long tty_compat_ioctl(struct file *file, unsigned int cmd,
        ld = tty_ldisc_ref_wait(tty);
        if (ld->ops->compat_ioctl)
                retval = ld->ops->compat_ioctl(tty, file, cmd, arg);
+       else
+               retval = n_tty_compat_ioctl_helper(tty, file, cmd, arg);
        tty_ldisc_deref(ld);
 
        return retval;
index 53f2442c609950ba27f84614c2efec51b6d4ad51..9314d93c1a20ab8b057670f56ee55bca23d66e44 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/module.h>
 #include <linux/bitops.h>
 #include <linux/mutex.h>
+#include <linux/compat.h>
 
 #include <asm/io.h>
 #include <asm/uaccess.h>
@@ -1179,3 +1180,19 @@ int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file,
        }
 }
 EXPORT_SYMBOL(n_tty_ioctl_helper);
+
+#ifdef CONFIG_COMPAT
+long n_tty_compat_ioctl_helper(struct tty_struct *tty, struct file *file,
+                                       unsigned int cmd, unsigned long arg)
+{
+       switch (cmd) {
+       case TIOCGLCKTRMIOS:
+       case TIOCSLCKTRMIOS:
+               return tty_mode_ioctl(tty, file, cmd, (unsigned long) compat_ptr(arg));
+       default:
+               return -ENOIOCTLCMD;
+       }
+}
+EXPORT_SYMBOL(n_tty_compat_ioctl_helper);
+#endif
+
index 0ad68889fc1a3e0c74f53dbccb53bfec67f44391..64c12a3e65f079a289d282c26b68291527307fb4 100644 (file)
@@ -579,6 +579,8 @@ extern int __init tty_init(void);
 /* tty_ioctl.c */
 extern int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file,
                       unsigned int cmd, unsigned long arg);
+extern long n_tty_compat_ioctl_helper(struct tty_struct *tty, struct file *file,
+                      unsigned int cmd, unsigned long arg);
 
 /* serial.c */