summaryrefslogtreecommitdiffstats
path: root/fs/xfs/libxfs/xfs_inode_buf.c
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2023-11-10 15:33:13 +1100
committerChandan Babu R <chandanbabu@kernel.org>2023-11-13 09:11:41 +0530
commit038ca189c0d2c1570b4d922f25b524007c85cf94 (patch)
tree9d78b83cdab4c29dbdd53e6fa6e89b029b36897a /fs/xfs/libxfs/xfs_inode_buf.c
parenta2e4388adfa44684c7c428a5a5980efe0d75e13e (diff)
downloadlinux-stable-038ca189c0d2c1570b4d922f25b524007c85cf94.tar.gz
linux-stable-038ca189c0d2c1570b4d922f25b524007c85cf94.tar.bz2
linux-stable-038ca189c0d2c1570b4d922f25b524007c85cf94.zip
xfs: inode recovery does not validate the recovered inode
Discovered when trying to track down a weird recovery corruption issue that wasn't detected at recovery time. The specific corruption was a zero extent count field when big extent counts are in use, and it turns out the dinode verifier doesn't detect that specific corruption case, either. So fix it too. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org> Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
Diffstat (limited to 'fs/xfs/libxfs/xfs_inode_buf.c')
-rw-r--r--fs/xfs/libxfs/xfs_inode_buf.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/xfs/libxfs/xfs_inode_buf.c b/fs/xfs/libxfs/xfs_inode_buf.c
index 543f3748c2a3..137a65bda95d 100644
--- a/fs/xfs/libxfs/xfs_inode_buf.c
+++ b/fs/xfs/libxfs/xfs_inode_buf.c
@@ -510,6 +510,9 @@ xfs_dinode_verify(
if (mode && nextents + naextents > nblocks)
return __this_address;
+ if (nextents + naextents == 0 && nblocks != 0)
+ return __this_address;
+
if (S_ISDIR(mode) && nextents > mp->m_dir_geo->max_extents)
return __this_address;