Commit aaebdee8 authored by Eric Biggers's avatar Eric Biggers Committed by Jaegeuk Kim

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

Since only an open file can be written to, 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 ->write_iter().

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 b82a6ea6
......@@ -2340,11 +2340,6 @@ static ssize_t f2fs_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
struct blk_plug plug;
ssize_t ret;
if (f2fs_encrypted_inode(inode) &&
!fscrypt_has_encryption_key(inode) &&
fscrypt_get_encryption_info(inode))
return -EACCES;
inode_lock(inode);
ret = generic_write_checks(iocb, from);
if (ret > 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment