From: Matt Ranostay <matt.ranostay@konsulko.com>
To: linux-kernel@vger.kernel.org
Cc: Matt Ranostay <matt.ranostay@konsulko.com>,
Rodolfo Giometti <giometti@enneenne.com>,
Moritz Fischer <mdf@kernel.org>,
George McCollister <george.mccollister@gmail.com>
Subject: [PATCH 1/2] pps: add ioctl_compat function to correct ioctl definitions
Date: Fri, 24 Feb 2017 12:23:46 -0800 [thread overview]
Message-ID: <20170224202347.11944-2-matt.ranostay@konsulko.com> (raw)
In-Reply-To: <20170224202347.11944-1-matt.ranostay@konsulko.com>
ioctl definitions use the pointer size of the architecture which
is fine when userspace and kernel are the same bitsize. This
patchset workarounds an issue with mixed bitsize kernel + userspace
by rewriting the cmd to the kernelspace architecture pointer size.
Cc: Rodolfo Giometti <giometti@enneenne.com>
Cc: Moritz Fischer <mdf@kernel.org>
Cc: George McCollister <george.mccollister@gmail.com>
Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
---
drivers/pps/pps.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/pps/pps.c b/drivers/pps/pps.c
index 2f07cd615665..452ead5a5e52 100644
--- a/drivers/pps/pps.c
+++ b/drivers/pps/pps.c
@@ -242,6 +242,18 @@ static long pps_cdev_ioctl(struct file *file,
return 0;
}
+#ifdef CONFIG_COMPAT
+static long pps_cdev_compat_ioctl(struct file *file,
+ unsigned int cmd, unsigned long arg)
+{
+ cmd = _IOC(_IOC_DIR(cmd), _IOC_TYPE(cmd), _IOC_NR(cmd), sizeof(void *));
+
+ return pps_cdev_ioctl(file, cmd, arg);
+}
+#else
+#define pps_cdev_compat_ioctl NULL
+#endif
+
static int pps_cdev_open(struct inode *inode, struct file *file)
{
struct pps_device *pps = container_of(inode->i_cdev,
@@ -268,6 +280,7 @@ static const struct file_operations pps_cdev_fops = {
.llseek = no_llseek,
.poll = pps_cdev_poll,
.fasync = pps_cdev_fasync,
+ .compat_ioctl = pps_cdev_compat_ioctl,
.unlocked_ioctl = pps_cdev_ioctl,
.open = pps_cdev_open,
.release = pps_cdev_release,
--
2.10.2
next prev parent reply other threads:[~2017-02-24 20:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-24 20:23 [PATCH 0/2] pps: add ioctl_compat support Matt Ranostay
2017-02-24 20:23 ` Matt Ranostay [this message]
2017-03-04 7:26 ` [PATCH 1/2] pps: add ioctl_compat function to correct ioctl definitions Rodolfo Giometti
2017-02-24 20:23 ` [PATCH 2/2] pps: fix padding issue with PPS_FETCH for ioctl_compat Matt Ranostay
2017-03-04 7:32 ` Rodolfo Giometti
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=20170224202347.11944-2-matt.ranostay@konsulko.com \
--to=matt.ranostay@konsulko.com \
--cc=george.mccollister@gmail.com \
--cc=giometti@enneenne.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mdf@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
all inboxes | Powered by JetHome®