Skip to content

Commit ec7b7f0

Browse files
pelwellpopcornmix
authored andcommitted
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 c2a49fe ("pps: fix padding issue with PPS_FETCH for ioctl_compat") See: #5430 Fixes: c2a49fe ("pps: fix padding issue with PPS_FETCH for ioctl_compat") Signed-off-by: Phil Elwell <[email protected]>
1 parent 686444b commit ec7b7f0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/pps/pps.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,12 +249,13 @@ static long pps_cdev_ioctl(struct file *file,
249249
static long pps_cdev_compat_ioctl(struct file *file,
250250
unsigned int cmd, unsigned long arg)
251251
{
252-
struct pps_device *pps = file->private_data;
253-
void __user *uarg = (void __user *) arg;
254252

255253
cmd = _IOC(_IOC_DIR(cmd), _IOC_TYPE(cmd), _IOC_NR(cmd), sizeof(void *));
256254

255+
#ifdef CONFIG_X86_64
257256
if (cmd == PPS_FETCH) {
257+
struct pps_device *pps = file->private_data;
258+
void __user *uarg = (void __user *) arg;
258259
struct pps_fdata_compat compat;
259260
struct pps_fdata fdata;
260261
int err;
@@ -289,6 +290,7 @@ static long pps_cdev_compat_ioctl(struct file *file,
289290
return copy_to_user(uarg, &compat,
290291
sizeof(struct pps_fdata_compat)) ? -EFAULT : 0;
291292
}
293+
#endif
292294

293295
return pps_cdev_ioctl(file, cmd, arg);
294296
}

0 commit comments

Comments
 (0)