From 114c59d6d9896996d4a5f44b30c2d8e79edb4660 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Mon, 9 Dec 2019 09:20:00 -0800 Subject: [PATCH] ANDROID: f2fs: fix possible merge of unencrypted with encrypted I/O f2fs_crypt_mergeable_bio() should return false when the next page will be read/written as raw data but the pending bio will use encryption. I'm not sure this actually fixes anything in practice, as I was unable to reproduce this case. But we should make this change to be safe. Bug: 137270441 Bug: 144791323 Change-Id: Id6765c799a6c54fe1d9542d350c3e1c105dc3f60 Signed-off-by: Eric Biggers --- fs/f2fs/data.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index f274c258d938..30eb0d73158c 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -340,7 +340,7 @@ static bool f2fs_crypt_mergeable_bio(struct bio *bio, const struct inode *inode, * read/write raw data without encryption. */ if (fio && fio->encrypted_page) - return true; + return !bio_has_crypt_ctx(bio); return fscrypt_mergeable_bio(bio, inode, next_idx); }