summaryrefslogtreecommitdiff
path: root/drivers/pps
diff options
context:
space:
mode:
authorMatt Ranostay <matt.ranostay@konsulko.com>2017-03-11 02:19:44 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-03-17 09:10:49 +0300
commit2ac6665701afd1946e1c93bd1308e97fd2b0ce10 (patch)
tree50892f5ba03a89fc853b267745f82b44fbfc0de6 /drivers/pps
parent48a5e6bdc2dd82281d7d6623a7395be7d6c3a95b (diff)
downloadlinux-2ac6665701afd1946e1c93bd1308e97fd2b0ce10.tar.xz
pps: add ioctl_compat function to correct ioctl definitions
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. Acked-by: Rodolfo Giometti <giometti@enneenne.com> Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/pps')
-rw-r--r--drivers/pps/pps.c13
1 files changed, 13 insertions, 0 deletions
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,