public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Meyer <thomas@m3y3r.de>
To: gregkh@suse.de
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH] Support compat_ioctl get/set termios_locked
Date: Sat, 24 Sep 2011 10:51:24 +0200	[thread overview]
Message-ID: <1316854289.1696.6.camel@localhost.localdomain> (raw)

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', which has the same
size (36 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>
---
 drivers/tty/n_tty.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 39d6ab6..24843da 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -40,6 +40,7 @@
 #include <linux/tty.h>
 #include <linux/timer.h>
 #include <linux/ctype.h>
+#include <linux/compat.h>
 #include <linux/mm.h>
 #include <linux/string.h>
 #include <linux/slab.h>
@@ -2095,6 +2096,20 @@ static int n_tty_ioctl(struct tty_struct *tty, struct file *file,
 	}
 }
 
+#ifdef CONFIG_COMPAT
+static long n_tty_compat_ioctl(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;
+	}
+}
+#endif
+
 struct tty_ldisc_ops tty_ldisc_N_TTY = {
 	.magic           = TTY_LDISC_MAGIC,
 	.name            = "n_tty",
@@ -2105,6 +2120,9 @@ struct tty_ldisc_ops tty_ldisc_N_TTY = {
 	.read            = n_tty_read,
 	.write           = n_tty_write,
 	.ioctl           = n_tty_ioctl,
+#ifdef CONFIG_COMPAT
+	.compat_ioctl    = n_tty_compat_ioctl,
+#endif
 	.set_termios     = n_tty_set_termios,
 	.poll            = n_tty_poll,
 	.receive_buf     = n_tty_receive_buf,
-- 
1.7.6.2



             reply	other threads:[~2011-09-24  8:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-24  8:51 Thomas Meyer [this message]
2011-09-25 11:11 ` [PATCH] Support compat_ioctl get/set termios_locked Arnd Bergmann
2011-09-28 17:37   ` Thomas Meyer
  -- strict thread matches above, loose matches on Subject: below --
2011-10-05 21:13 Thomas Meyer
2011-04-30 14:18 Thomas Meyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1316854289.1696.6.camel@localhost.localdomain \
    --to=thomas@m3y3r.de \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox