]> git.hungrycats.org Git - linux/commitdiff
btrfs: bugfix: handle FS_IOC32_{GETFLAGS,SETFLAGS,GETVERSION} in btrfs_ioctl
authorLuke Dashjr <luke@dashjr.org>
Thu, 29 Oct 2015 08:22:21 +0000 (08:22 +0000)
committerSasha Levin <sasha.levin@oracle.com>
Fri, 3 Jun 2016 15:30:29 +0000 (11:30 -0400)
[ Upstream commit 4c63c2454eff996c5e27991221106eb511f7db38 ]

32-bit ioctl uses these rather than the regular FS_IOC_* versions. They can
be handled in btrfs using the same code. Without this, 32-bit {ch,ls}attr
fail.

Signed-off-by: Luke Dashjr <luke-jr+git@utopios.org>
Cc: stable@vger.kernel.org
Reviewed-by: Josef Bacik <jbacik@fb.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
fs/btrfs/ctree.h
fs/btrfs/file.c
fs/btrfs/inode.c
fs/btrfs/ioctl.c

index ba5aec76e6f8e5981779e001dc1773d14bda4ff3..42d11e7cf7fe179c18768f96b950c4c3587e7dae 100644 (file)
@@ -3866,6 +3866,7 @@ extern const struct dentry_operations btrfs_dentry_operations;
 
 /* ioctl.c */
 long btrfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
+long btrfs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
 void btrfs_update_iflags(struct inode *inode);
 void btrfs_inherit_iflags(struct inode *inode, struct inode *dir);
 int btrfs_is_empty_uuid(u8 *uuid);
index e557e4ca039298cfc059c8c1c4716ed9fa62153d..2ad4cb3da8f657c8b15bfd53b1110a3de0be9c72 100644 (file)
@@ -2797,7 +2797,7 @@ const struct file_operations btrfs_file_operations = {
        .fallocate      = btrfs_fallocate,
        .unlocked_ioctl = btrfs_ioctl,
 #ifdef CONFIG_COMPAT
-       .compat_ioctl   = btrfs_ioctl,
+       .compat_ioctl   = btrfs_compat_ioctl,
 #endif
 };
 
index c8d287fff7bcaee9df2ddae8405ff466a2c72ead..ef677cdf777fbe29068ed30396695dc02985d09d 100644 (file)
@@ -9513,7 +9513,7 @@ static const struct file_operations btrfs_dir_file_operations = {
        .iterate        = btrfs_real_readdir,
        .unlocked_ioctl = btrfs_ioctl,
 #ifdef CONFIG_COMPAT
-       .compat_ioctl   = btrfs_ioctl,
+       .compat_ioctl   = btrfs_compat_ioctl,
 #endif
        .release        = btrfs_release_file,
        .fsync          = btrfs_sync_file,
index 31c9f6471ce70ef93507f58e551f23e80fe1f942..1c1ee12ab0cfa2f42fa6135e10198fd5d4b0afb6 100644 (file)
@@ -5495,3 +5495,24 @@ long btrfs_ioctl(struct file *file, unsigned int
 
        return -ENOTTY;
 }
+
+#ifdef CONFIG_COMPAT
+long btrfs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+{
+       switch (cmd) {
+       case FS_IOC32_GETFLAGS:
+               cmd = FS_IOC_GETFLAGS;
+               break;
+       case FS_IOC32_SETFLAGS:
+               cmd = FS_IOC_SETFLAGS;
+               break;
+       case FS_IOC32_GETVERSION:
+               cmd = FS_IOC_GETVERSION;
+               break;
+       default:
+               return -ENOIOCTLCMD;
+       }
+
+       return btrfs_ioctl(file, cmd, (unsigned long) compat_ptr(arg));
+}
+#endif