ceph: fix compat_ioctl for ceph_dir_operations
authorArnd Bergmann <arnd@arndb.de>
Tue, 11 Sep 2018 18:47:23 +0000 (20:47 +0200)
committerArnd Bergmann <arnd@arndb.de>
Wed, 23 Oct 2019 15:19:52 +0000 (17:19 +0200)
The ceph_ioctl function is used both for files and directories, but only
the files support doing that in 32-bit compat mode.

On the s390 architecture, there is also a problem with invalid 31-bit
pointers that need to be passed through compat_ptr().

Use the new compat_ptr_ioctl() to address both issues.

Note: When backporting this patch to stable kernels, "compat_ioctl:
add compat_ptr_ioctl()" is needed as well.

Reviewed-by: "Yan, Zheng" <zyan@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
fs/ceph/dir.c
fs/ceph/file.c

index 4ca0b8f..811f45b 100644 (file)
@@ -1808,6 +1808,7 @@ const struct file_operations ceph_dir_fops = {
        .open = ceph_open,
        .release = ceph_release,
        .unlocked_ioctl = ceph_ioctl,
+       .compat_ioctl = compat_ptr_ioctl,
        .fsync = ceph_fsync,
        .lock = ceph_lock,
        .flock = ceph_flock,
index d277f71..6092cce 100644 (file)
@@ -2162,7 +2162,7 @@ const struct file_operations ceph_file_fops = {
        .splice_read = generic_file_splice_read,
        .splice_write = iter_file_splice_write,
        .unlocked_ioctl = ceph_ioctl,
-       .compat_ioctl   = ceph_ioctl,
+       .compat_ioctl = compat_ptr_ioctl,
        .fallocate      = ceph_fallocate,
        .copy_file_range = ceph_copy_file_range,
 };