From: Dave Chinner Date: Tue, 5 Jun 2018 17:09:33 +0000 (-0700) Subject: xfs: verify COW extent size hint is valid in inode verifier X-Git-Tag: v4.18-rc1~37^2~12 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=02a0fda;p=uclinux-h8%2Flinux.git xfs: verify COW extent size hint is valid in inode verifier 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 --- diff --git a/fs/xfs/libxfs/xfs_inode_buf.c b/fs/xfs/libxfs/xfs_inode_buf.c index 1fe18555b451..eecf654b4188 100644 --- a/fs/xfs/libxfs/xfs_inode_buf.c +++ b/fs/xfs/libxfs/xfs_inode_buf.c @@ -543,6 +543,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; }