f2fs: deny accessing encryption policy if encryption is off
This patch adds missing feature check in encryption ioctl interface. Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
c394842e26
commit
56a07b0705
1 changed files with 5 additions and 0 deletions
|
@ -1905,6 +1905,9 @@ static int f2fs_ioc_set_encryption_policy(struct file *filp, unsigned long arg)
|
|||
{
|
||||
struct inode *inode = file_inode(filp);
|
||||
|
||||
if (!f2fs_sb_has_crypto(inode->i_sb))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
f2fs_update_time(F2FS_I_SB(inode), REQ_TIME);
|
||||
|
||||
return fscrypt_ioctl_set_policy(filp, (const void __user *)arg);
|
||||
|
@ -1912,6 +1915,8 @@ static int f2fs_ioc_set_encryption_policy(struct file *filp, unsigned long arg)
|
|||
|
||||
static int f2fs_ioc_get_encryption_policy(struct file *filp, unsigned long arg)
|
||||
{
|
||||
if (!f2fs_sb_has_crypto(file_inode(filp)->i_sb))
|
||||
return -EOPNOTSUPP;
|
||||
return fscrypt_ioctl_get_policy(filp, (void __user *)arg);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue