Skip to content

Commit

Permalink
f2fs: deny accessing encryption policy if encryption is off
Browse files Browse the repository at this point in the history
This patch adds missing feature check in encryption ioctl interface.

Signed-off-by: Chao Yu <[email protected]>
Signed-off-by: Jaegeuk Kim <[email protected]>
  • Loading branch information
chaseyu authored and Jaegeuk Kim committed Nov 15, 2017
1 parent 812c605 commit ead710b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions fs/f2fs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -1928,13 +1928,18 @@ 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);
}

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);
}

Expand Down

0 comments on commit ead710b

Please sign in to comment.