-
Notifications
You must be signed in to change notification settings - Fork 3
/
0003-pps-Compatibility-hack-should-be-X86-specific.patch
53 lines (44 loc) · 1.78 KB
/
0003-pps-Compatibility-hack-should-be-X86-specific.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
From b487e9b4c128c36682f162e70b7dc0064a0494be Mon Sep 17 00:00:00 2001
From: Phil Elwell <[email protected]>
Date: Mon, 22 May 2023 14:22:55 +0100
Subject: [PATCH 3/3] pps: Compatibility hack should be X86-specific
As of [1], using PPS_FETCH on a 64-bit ARM kernel with a 32-bit userland
is broken, returning a timeout. This is because the requested 4-byte
alignment for struct pps_ktime_compat (illegal on arm64) results in the
timeout flags field being uninitialised.
Make the hack specific to X86_64 builds with CONFIG_COMPAT defined.
[1] commit c2a49fe8eeef ("pps: fix padding issue with PPS_FETCH for
ioctl_compat")
See: https://github.com/raspberrypi/linux/issues/5430
Fixes: c2a49fe8eeef ("pps: fix padding issue with PPS_FETCH for ioctl_compat")
Signed-off-by: Phil Elwell <[email protected]>
---
drivers/pps/pps.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/pps/pps.c b/drivers/pps/pps.c
index 5d19baae6a38..0675c8a2e560 100644
--- a/drivers/pps/pps.c
+++ b/drivers/pps/pps.c
@@ -249,12 +249,13 @@ static long pps_cdev_ioctl(struct file *file,
static long pps_cdev_compat_ioctl(struct file *file,
unsigned int cmd, unsigned long arg)
{
- struct pps_device *pps = file->private_data;
- void __user *uarg = (void __user *) arg;
cmd = _IOC(_IOC_DIR(cmd), _IOC_TYPE(cmd), _IOC_NR(cmd), sizeof(void *));
+#ifdef CONFIG_X86_64
if (cmd == PPS_FETCH) {
+ struct pps_device *pps = file->private_data;
+ void __user *uarg = (void __user *) arg;
struct pps_fdata_compat compat;
struct pps_fdata fdata;
int err;
@@ -289,6 +290,7 @@ static long pps_cdev_compat_ioctl(struct file *file,
return copy_to_user(uarg, &compat,
sizeof(struct pps_fdata_compat)) ? -EFAULT : 0;
}
+#endif
return pps_cdev_ioctl(file, cmd, arg);
}
--
2.46.1