From: "Darrick J. Wong" <djwong@kernel.org>
To: Dave Chinner <david@fromorbit.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 2/2] xfs: don't consider future format versions valid
Date: Tue, 11 Apr 2023 16:32:41 -0700 [thread overview]
Message-ID: <20230411233241.GM360889@frogsfrogsfrogs> (raw)
In-Reply-To: <20230411232342.233433-3-david@fromorbit.com>
On Wed, Apr 12, 2023 at 09:23:42AM +1000, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
>
> 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>
Ugh, old code...
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
--D
> ---
> fs/xfs/libxfs/xfs_sb.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/fs/xfs/libxfs/xfs_sb.c b/fs/xfs/libxfs/xfs_sb.c
> index 99cc03a298e2..ba0f17bc1dc0 100644
> --- a/fs/xfs/libxfs/xfs_sb.c
> +++ b/fs/xfs/libxfs/xfs_sb.c
> @@ -72,7 +72,8 @@ xfs_sb_validate_v5_features(
> }
>
> /*
> - * We support all XFS versions newer than a v4 superblock with V2 directories.
> + * We current support XFS v5 formats with known features and v4 superblocks with
> + * at least V2 directories.
> */
> bool
> xfs_sb_good_version(
> @@ -86,16 +87,16 @@ xfs_sb_good_version(
> if (xfs_sb_is_v5(sbp))
> return xfs_sb_validate_v5_features(sbp);
>
> + /* versions prior to v4 are not supported */
> + if (XFS_SB_VERSION_NUM(sbp) != XFS_SB_VERSION_4)
> + return false;
> +
> /* We must not have any unknown v4 feature bits set */
> if ((sbp->sb_versionnum & ~XFS_SB_VERSION_OKBITS) ||
> ((sbp->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT) &&
> (sbp->sb_features2 & ~XFS_SB_VERSION2_OKBITS)))
> return false;
>
> - /* versions prior to v4 are not supported */
> - if (XFS_SB_VERSION_NUM(sbp) < XFS_SB_VERSION_4)
> - return false;
> -
> /* V4 filesystems need v2 directories and unwritten extents */
> if (!(sbp->sb_versionnum & XFS_SB_VERSION_DIRV2BIT))
> return false;
> --
> 2.39.2
>
next prev parent reply other threads:[~2023-04-11 23:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-11 23:23 [PATCH 0/2] xfs: a couple of syzbot fixes Dave Chinner
2023-04-11 23:23 ` [PATCH 1/2] xfs: remove WARN when dquot cache insertion fails Dave Chinner
2023-04-11 23:32 ` Darrick J. Wong
2023-04-12 12:10 ` Christoph Hellwig
2023-04-11 23:23 ` [PATCH 2/2] xfs: don't consider future format versions valid Dave Chinner
2023-04-11 23:32 ` Darrick J. Wong [this message]
2023-04-12 12:13 ` Christoph Hellwig
2023-04-12 21:37 ` Dave Chinner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230411233241.GM360889@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=david@fromorbit.com \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox