xfs: don't consider future format versions valid
authorDave Chinner <dchinner@redhat.com>
Wed, 12 Apr 2023 05:48:50 +0000 (15:48 +1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 11 May 2023 14:03:05 +0000 (23:03 +0900)
commit0ae98a8b4f00644f0d5ec185e108d798ed8f0874
tree85e955a219e3b6b734b45febee02faf3cca312fa
parent2b2515b8095cf2149bef44383a99d5b5677f1831
xfs: don't consider future format versions valid

commit aa88019851a85df80cb77f143758b13aee09e3d9 upstream.

In commit fe08cc504448 we reworked the valid superblock version
checks. If it is a V5 filesystem, it is always valid, then we
checked if the version was less than V4 (reject) and then checked
feature fields in the V4 flags to determine if it was valid.

What we missed was that if the version is not V4 at this point,
we shoudl reject the fs. i.e. the check current treats V6+
filesystems as if it was a v4 filesystem. Fix this.

cc: stable@vger.kernel.org
Fixes: fe08cc504448 ("xfs: open code sb verifier feature checks")
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/xfs/libxfs/xfs_sb.c