From cd0265fcd2eae9004c68ef2123a9dac0dc5a666a Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Mon, 18 Mar 2019 10:23:33 -0700 Subject: fscrypt: drop inode argument from fscrypt_get_ctx() The only reason the inode is being passed to fscrypt_get_ctx() is to verify that the encryption key is available. However, all callers already ensure this because if we get as far as trying to do I/O to an encrypted file without the key, there's already a bug. Therefore, remove this unnecessary argument. Signed-off-by: Eric Biggers Signed-off-by: Theodore Ts'o --- fs/crypto/bio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/crypto/bio.c') diff --git a/fs/crypto/bio.c b/fs/crypto/bio.c index 5759bcd018cd..f5b69b9531f6 100644 --- a/fs/crypto/bio.c +++ b/fs/crypto/bio.c @@ -104,7 +104,7 @@ int fscrypt_zeroout_range(const struct inode *inode, pgoff_t lblk, BUG_ON(inode->i_sb->s_blocksize != PAGE_SIZE); - ctx = fscrypt_get_ctx(inode, GFP_NOFS); + ctx = fscrypt_get_ctx(GFP_NOFS); if (IS_ERR(ctx)) return PTR_ERR(ctx); -- cgit v1.2.3 From ff5d3a97075c65731a46453d36e75b9cf925e165 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Fri, 15 Mar 2019 14:16:32 -0700 Subject: fscrypt: remove WARN_ON_ONCE() when decryption fails If decrypting a block fails, fscrypt did a WARN_ON_ONCE(). But WARN is meant for kernel bugs, which this isn't; this could be hit by fuzzers using fault injection, for example. Also, there is already a proper warning message logged in fscrypt_do_page_crypto(), so the WARN doesn't add much. Just remove the unnessary WARN. Signed-off-by: Eric Biggers Signed-off-by: Theodore Ts'o --- fs/crypto/bio.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'fs/crypto/bio.c') diff --git a/fs/crypto/bio.c b/fs/crypto/bio.c index f5b69b9531f6..41dde4578f3b 100644 --- a/fs/crypto/bio.c +++ b/fs/crypto/bio.c @@ -37,12 +37,10 @@ static void __fscrypt_decrypt_bio(struct bio *bio, bool done) int ret = fscrypt_decrypt_page(page->mapping->host, page, PAGE_SIZE, 0, page->index); - if (ret) { - WARN_ON_ONCE(1); + if (ret) SetPageError(page); - } else if (done) { + else if (done) SetPageUptodate(page); - } if (done) unlock_page(page); } -- cgit v1.2.3