Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1587920 > unrolled thread

[PATCH 1/2] pps: add ioctl_compat function to correct ioctl definitions

Started byMatt Ranostay <matt.ranostay@konsulko.com>
First post2017-02-24 21:30 +0100
Last post2017-02-24 21:30 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 1/2] pps: add ioctl_compat function to correct ioctl definitions Matt Ranostay <matt.ranostay@konsulko.com> - 2017-02-24 21:30 +0100

#1587920 — [PATCH 1/2] pps: add ioctl_compat function to correct ioctl definitions

FromMatt Ranostay <matt.ranostay@konsulko.com>
Date2017-02-24 21:30 +0100
Subject[PATCH 1/2] pps: add ioctl_compat function to correct ioctl definitions
Message-ID<teuF4-5q2-13@gated-at.bofh.it>
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

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web