Skip to content

Commit

Permalink
ubifs: don't bother checking for encryption key in ->mmap()
Browse files Browse the repository at this point in the history
Since only an open file can be mmap'ed, and we only allow open()ing an
encrypted file when its key is available, there is no need to check for
the key again before permitting each mmap().

Signed-off-by: Eric Biggers <[email protected]>
Acked-by: Richard Weinberger <[email protected]>
Signed-off-by: Richard Weinberger <[email protected]>
  • Loading branch information
ebiggers authored and richardweinberger committed Jul 5, 2017
1 parent 4afb999 commit af65936
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions fs/ubifs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -1615,15 +1615,6 @@ static const struct vm_operations_struct ubifs_file_vm_ops = {
static int ubifs_file_mmap(struct file *file, struct vm_area_struct *vma)
{
int err;
struct inode *inode = file->f_mapping->host;

if (ubifs_crypt_is_encrypted(inode)) {
err = fscrypt_get_encryption_info(inode);
if (err)
return -EACCES;
if (!fscrypt_has_encryption_key(inode))
return -ENOKEY;
}

err = generic_file_mmap(file, vma);
if (err)
Expand Down

0 comments on commit af65936

Please sign in to comment.