On Sun, May 09, 2021 at 12:09:04PM +0200, gregkh@linuxfoundation.org wrote:
The patch below does not apply to the 5.4-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to stable@vger.kernel.org.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 3c0315424f5e3d2a4113c7272367bee1e8e6a174 Mon Sep 17 00:00:00 2001
From: Eric Biggers ebiggers@google.com Date: Thu, 4 Mar 2021 21:43:10 -0800 Subject: [PATCH] f2fs: fix error handling in f2fs_end_enable_verity()
f2fs didn't properly clean up if verity failed to be enabled on a file:
It left verity metadata (pages past EOF) in the page cache, which would be exposed to userspace if the file was later extended.
It didn't truncate the verity metadata at all (either from cache or from disk) if an error occurred while setting the verity bit.
Fix these bugs by adding a call to truncate_inode_pages() and ensuring that we truncate the verity metadata (both from cache and from disk) in all error paths. Also rework the code to cleanly separate the success path from the error paths, which makes it much easier to understand.
Finally, log a message if f2fs_truncate() fails, since it might otherwise fail silently.
Reported-by: Yunlei He heyunlei@hihonor.com Fixes: 95ae251fe828 ("f2fs: add fs-verity support") Cc: stable@vger.kernel.org # v5.4+ Signed-off-by: Eric Biggers ebiggers@google.com Reviewed-by: Chao Yu yuchao0@huawei.com Signed-off-by: Jaegeuk Kim jaegeuk@kernel.org
This is a clean cherry-pick, and it compiles. So I don't see what the problem is.
- Eric