From: Theodore Ts'o Date: Tue, 13 Dec 2016 02:50:28 +0000 (-0500) Subject: Merge branch 'fscrypt' into dev X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=a551d7c8deefb6d9fb45a1de03a617dd064e0419;p=linux-beck.git Merge branch 'fscrypt' into dev --- a551d7c8deefb6d9fb45a1de03a617dd064e0419 diff --cc fs/ext4/ioctl.c index fcc9510a819c,70083863ce51..49fd1371bfa2 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c @@@ -787,24 -765,13 +787,14 @@@ resizefs_out } case EXT4_IOC_PRECACHE_EXTENTS: return ext4_ext_precache(inode); - case EXT4_IOC_SET_ENCRYPTION_POLICY: { - #ifdef CONFIG_EXT4_FS_ENCRYPTION - struct fscrypt_policy policy; + case EXT4_IOC_SET_ENCRYPTION_POLICY: if (!ext4_has_feature_encrypt(sb)) return -EOPNOTSUPP; + return fscrypt_ioctl_set_policy(filp, (const void __user *)arg); - if (copy_from_user(&policy, - (struct fscrypt_policy __user *)arg, - sizeof(policy))) - return -EFAULT; - return fscrypt_process_policy(filp, &policy); - #else - return -EOPNOTSUPP; - #endif - } case EXT4_IOC_GET_ENCRYPTION_PWSALT: { +#ifdef CONFIG_EXT4_FS_ENCRYPTION int err, err2; struct ext4_sb_info *sbi = EXT4_SB(sb); handle_t *handle; @@@ -839,27 -806,10 +829,13 @@@ sbi->s_es->s_encrypt_pw_salt, 16)) return -EFAULT; return 0; +#else + return -EOPNOTSUPP; +#endif } - case EXT4_IOC_GET_ENCRYPTION_POLICY: { - #ifdef CONFIG_EXT4_FS_ENCRYPTION - struct fscrypt_policy policy; - int err = 0; + case EXT4_IOC_GET_ENCRYPTION_POLICY: + return fscrypt_ioctl_get_policy(filp, (void __user *)arg); - if (!ext4_encrypted_inode(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; - #else - return -EOPNOTSUPP; - #endif - } case EXT4_IOC_FSGETXATTR: { struct fsxattr fa;