ubifs: don't bother checking for encryption key in ->mmap()
authorEric Biggers <ebiggers@google.com>
Tue, 23 May 2017 00:39:44 +0000 (17:39 -0700)
committerRichard Weinberger <richard@nod.at>
Wed, 5 Jul 2017 21:52:50 +0000 (23:52 +0200)
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 <ebiggers@google.com>
Acked-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Richard Weinberger <richard@nod.at>
fs/ubifs/file.c

index ee3ff4c6bf4a58e505b1018166236d6323dc954b..c1d352842ee2eccd74de30a3c91d81e8c106ce5b 100644 (file)
@@ -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)