fscrypto: lock inode while setting encryption policy
am: 3a19419c50
Change-Id: I3926f8d43c5d7f4c3648460bc103f24d05b6f3ee
This commit is contained in:
commit
2bc9e957b2
2 changed files with 12 additions and 1 deletions
|
@ -637,8 +637,12 @@ resizefs_out:
|
|||
if (err)
|
||||
goto encryption_policy_out;
|
||||
|
||||
mutex_lock(&inode->i_mutex);
|
||||
|
||||
err = ext4_process_policy(&policy, inode);
|
||||
|
||||
mutex_unlock(&inode->i_mutex);
|
||||
|
||||
mnt_drop_write_file(filp);
|
||||
encryption_policy_out:
|
||||
return err;
|
||||
|
|
|
@ -1535,12 +1535,19 @@ static int f2fs_ioc_set_encryption_policy(struct file *filp, unsigned long arg)
|
|||
#ifdef CONFIG_F2FS_FS_ENCRYPTION
|
||||
struct f2fs_encryption_policy policy;
|
||||
struct inode *inode = file_inode(filp);
|
||||
int err;
|
||||
|
||||
if (copy_from_user(&policy, (struct f2fs_encryption_policy __user *)arg,
|
||||
sizeof(policy)))
|
||||
return -EFAULT;
|
||||
|
||||
return f2fs_process_policy(&policy, inode);
|
||||
mutex_lock(&inode->i_mutex);
|
||||
|
||||
err = f2fs_process_policy(&policy, inode);
|
||||
|
||||
mutex_unlock(&inode->i_mutex);
|
||||
|
||||
return err;
|
||||
#else
|
||||
return -EOPNOTSUPP;
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue