From 77e17d581b9d091904f6ad174c431622b439521d Mon Sep 17 00:00:00 2001 From: Dave Chinner Date: Thu, 28 Jun 2018 15:11:58 -0500 Subject: [PATCH] xfs: verify COW extent size hint is valid in inode verifier Source kernel commit: 02a0fda875c89e826c9f9f7e6861a0314d6a6b7d There are rules for vald extent size hints. We enforce them when applications set them, but fuzzers violate those rules and that screws us over. Validate COW extent size hint rules in the inode verifier to catch this. Signed-off-by: Dave Chinner Reviewed-by: Carlos Maiolino Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong Signed-off-by: Eric Sandeen --- libxfs/xfs_inode_buf.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libxfs/xfs_inode_buf.c b/libxfs/xfs_inode_buf.c index 5b8d3024a..062776a23 100644 --- a/libxfs/xfs_inode_buf.c +++ b/libxfs/xfs_inode_buf.c @@ -539,6 +539,12 @@ xfs_dinode_verify( if ((flags2 & XFS_DIFLAG2_REFLINK) && (flags2 & XFS_DIFLAG2_DAX)) return __this_address; + /* COW extent size hint validation */ + fa = xfs_inode_validate_cowextsize(mp, be32_to_cpu(dip->di_cowextsize), + mode, flags, flags2); + if (fa) + return fa; + return NULL; } -- 2.47.2