summaryrefslogtreecommitdiff
path: root/fs/ioctl.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2019-04-21 19:24:03 -0400
committerArnd Bergmann <arnd@arndb.de>2019-10-23 17:15:57 +0200
commit011da44bc5b6520d00b42c584a4fefc85f7b332b (patch)
treeb427daf4e0a56740cf791e391c66b8ee4ba12bc3 /fs/ioctl.c
parent34d3d0e65e3a84bc76e75431528e41f9f94bd6cf (diff)
compat: move FS_IOC_RESVSP_32 handling to fs/ioctl.c
... and lose the ridiculous games with compat_alloc_user_space() there. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'fs/ioctl.c')
-rw-r--r--fs/ioctl.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/fs/ioctl.c b/fs/ioctl.c
index e14bd85f3bc6..812061ba667a 100644
--- a/fs/ioctl.c
+++ b/fs/ioctl.c
@@ -491,6 +491,35 @@ int ioctl_preallocate(struct file *filp, void __user *argp)
return vfs_fallocate(filp, FALLOC_FL_KEEP_SIZE, sr.l_start, sr.l_len);
}
+/* on ia32 l_start is on a 32-bit boundary */
+#if defined CONFIG_COMPAT && defined(CONFIG_X86_64)
+/* just account for different alignment */
+int compat_ioctl_preallocate(struct file *file,
+ struct space_resv_32 __user *argp)
+{
+ struct inode *inode = file_inode(file);
+ struct space_resv_32 sr;
+
+ if (copy_from_user(&sr, argp, sizeof(sr)))
+ return -EFAULT;
+
+ switch (sr.l_whence) {
+ case SEEK_SET:
+ break;
+ case SEEK_CUR:
+ sr.l_start += file->f_pos;
+ break;
+ case SEEK_END:
+ sr.l_start += i_size_read(inode);
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ return vfs_fallocate(file, FALLOC_FL_KEEP_SIZE, sr.l_start, sr.l_len);
+}
+#endif
+
static int file_ioctl(struct file *filp, unsigned int cmd,
unsigned long arg)
{