summaryrefslogtreecommitdiffstats
path: root/fs/ubifs/ioctl.c
diff options
context:
space:
mode:
authorRichard Weinberger <richard@nod.at>2016-12-13 00:27:59 +0100
committerRichard Weinberger <richard@nod.at>2016-12-13 19:54:52 +0100
commitec9160dacdb08eaeb40a878db97dfed6c2212d91 (patch)
tree87efd23a1d2afdc6c97f8c4ececce55c87ea2e9e /fs/ubifs/ioctl.c
parent385886686609dbdcd2e8f55c358647faa8d4f89e (diff)
downloadlinux-ec9160dacdb08eaeb40a878db97dfed6c2212d91.tar.bz2
ubifs: Use fscrypt ioctl() helpers
Commit db717d8e26c2 ("fscrypto: move ioctl processing more fully into common code") moved ioctl() related functions into fscrypt and offers us now a set of helper functions. Signed-off-by: Richard Weinberger <richard@nod.at> Reviewed-by: David Gstir <david@sigma-star.at>
Diffstat (limited to 'fs/ubifs/ioctl.c')
-rw-r--r--fs/ubifs/ioctl.c24
1 files changed, 2 insertions, 22 deletions
diff --git a/fs/ubifs/ioctl.c b/fs/ubifs/ioctl.c
index 3d10f5525274..78d713644df3 100644
--- a/fs/ubifs/ioctl.c
+++ b/fs/ubifs/ioctl.c
@@ -184,39 +184,19 @@ long ubifs_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
case FS_IOC_SET_ENCRYPTION_POLICY: {
#ifdef CONFIG_UBIFS_FS_ENCRYPTION
struct ubifs_info *c = inode->i_sb->s_fs_info;
- struct fscrypt_policy policy;
-
- if (copy_from_user(&policy,
- (struct fscrypt_policy __user *)arg,
- sizeof(policy)))
- return -EFAULT;
err = ubifs_enable_encryption(c);
if (err)
return err;
- err = fscrypt_process_policy(file, &policy);
-
- return err;
+ return fscrypt_ioctl_set_policy(file, (const void __user *)arg);
#else
return -EOPNOTSUPP;
#endif
}
case FS_IOC_GET_ENCRYPTION_POLICY: {
#ifdef CONFIG_UBIFS_FS_ENCRYPTION
- struct fscrypt_policy policy;
-
- if (!ubifs_crypt_is_encrypted(inode))
- return -ENOENT;
-
- err = fscrypt_get_policy(inode, &policy);
- if (err)
- return err;
-
- if (copy_to_user((void __user *)arg, &policy, sizeof(policy)))
- return -EFAULT;
-
- return 0;
+ return fscrypt_ioctl_get_policy(file, (void __user *)arg);
#else
return -EOPNOTSUPP;
#endif