diff options
author | Jeff Mahoney <jeffm@suse.com> | 2017-02-06 19:39:09 -0500 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2017-02-08 11:47:30 -0500 |
commit | 2a362249187a8d0f6d942d6e1d763d150a296f47 (patch) | |
tree | a82a639c63ee3a78259c9ee909d19c2c48d9d3d3 | |
parent | 57b59ed2e5b91e958843609c7884794e29e6c4cb (diff) |
btrfs: fix btrfs_compat_ioctl failures on non-compat ioctls
Commit 4c63c2454ef incorrectly assumed that returning -ENOIOCTLCMD would
cause the native ioctl to be called. The ->compat_ioctl callback is
expected to handle all ioctls, not just compat variants. As a result,
when using 32-bit userspace on 64-bit kernels, everything except those
three ioctls would return -ENOTTY.
Fixes: 4c63c2454ef ("btrfs: bugfix: handle FS_IOC32_{GETFLAGS,SETFLAGS,GETVERSION} in btrfs_ioctl")
Cc: stable@vger.kernel.org
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r-- | fs/btrfs/ioctl.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 0a6902555e65..0c77cad89e87 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -5665,6 +5665,10 @@ long btrfs_ioctl(struct file *file, unsigned int | |||
5665 | #ifdef CONFIG_COMPAT | 5665 | #ifdef CONFIG_COMPAT |
5666 | long btrfs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | 5666 | long btrfs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
5667 | { | 5667 | { |
5668 | /* | ||
5669 | * These all access 32-bit values anyway so no further | ||
5670 | * handling is necessary. | ||
5671 | */ | ||
5668 | switch (cmd) { | 5672 | switch (cmd) { |
5669 | case FS_IOC32_GETFLAGS: | 5673 | case FS_IOC32_GETFLAGS: |
5670 | cmd = FS_IOC_GETFLAGS; | 5674 | cmd = FS_IOC_GETFLAGS; |
@@ -5675,8 +5679,6 @@ long btrfs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
5675 | case FS_IOC32_GETVERSION: | 5679 | case FS_IOC32_GETVERSION: |
5676 | cmd = FS_IOC_GETVERSION; | 5680 | cmd = FS_IOC_GETVERSION; |
5677 | break; | 5681 | break; |
5678 | default: | ||
5679 | return -ENOIOCTLCMD; | ||
5680 | } | 5682 | } |
5681 | 5683 | ||
5682 | return btrfs_ioctl(file, cmd, (unsigned long) compat_ptr(arg)); | 5684 | return btrfs_ioctl(file, cmd, (unsigned long) compat_ptr(arg)); |