]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
f2fs: don't bother checking for encryption key in ->mmap()
authorEric Biggers <ebiggers@google.com>
Tue, 23 May 2017 00:39:43 +0000 (17:39 -0700)
committerJaegeuk Kim <jaegeuk@kernel.org>
Wed, 24 May 2017 04:10:36 +0000 (21:10 -0700)
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().

This f2fs copy of this code was also broken in that it wouldn't actually
have failed if the key was in fact unavailable.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: David Gstir <david@sigma-star.at>
Acked-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/file.c

index 8ccbfe53c03c2a35216c603ab08c9319710f7a3f..30fbb4ce6a735ff3858ddc74cd20845305cdd3f6 100644 (file)
@@ -415,14 +415,6 @@ static int f2fs_file_mmap(struct file *file, struct vm_area_struct *vma)
        struct inode *inode = file_inode(file);
        int err;
 
-       if (f2fs_encrypted_inode(inode)) {
-               err = fscrypt_get_encryption_info(inode);
-               if (err)
-                       return 0;
-               if (!f2fs_encrypted_inode(inode))
-                       return -ENOKEY;
-       }
-
        /* we don't need to use inline_data strictly */
        err = f2fs_convert_inline_inode(inode);
        if (err)