Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9c751fd7 authored by Eric Biggers's avatar Eric Biggers Committed by Jaegeuk Kim
Browse files

f2fs: don't bother checking for encryption key in ->mmap()



commit b82a6ea6ec39f1b5ef949a38e334eed0dc29f4d1 upstream.

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: default avatarEric Biggers <ebiggers@google.com>
Reviewed-by: default avatarDavid Gstir <david@sigma-star.at>
Acked-by: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 2aa56aea
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -417,14 +417,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)