Skip to content

Commit 2ac6665

Browse files
mranostaygregkh
authored andcommitted
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 <[email protected]> Signed-off-by: Matt Ranostay <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 48a5e6b commit 2ac6665

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

drivers/pps/pps.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,18 @@ static long pps_cdev_ioctl(struct file *file,
242242
return 0;
243243
}
244244

245+
#ifdef CONFIG_COMPAT
246+
static long pps_cdev_compat_ioctl(struct file *file,
247+
unsigned int cmd, unsigned long arg)
248+
{
249+
cmd = _IOC(_IOC_DIR(cmd), _IOC_TYPE(cmd), _IOC_NR(cmd), sizeof(void *));
250+
251+
return pps_cdev_ioctl(file, cmd, arg);
252+
}
253+
#else
254+
#define pps_cdev_compat_ioctl NULL
255+
#endif
256+
245257
static int pps_cdev_open(struct inode *inode, struct file *file)
246258
{
247259
struct pps_device *pps = container_of(inode->i_cdev,
@@ -268,6 +280,7 @@ static const struct file_operations pps_cdev_fops = {
268280
.llseek = no_llseek,
269281
.poll = pps_cdev_poll,
270282
.fasync = pps_cdev_fasync,
283+
.compat_ioctl = pps_cdev_compat_ioctl,
271284
.unlocked_ioctl = pps_cdev_ioctl,
272285
.open = pps_cdev_open,
273286
.release = pps_cdev_release,

0 commit comments

Comments
 (0)