From: "Darrick J. Wong" <djwong@kernel.org>
To: Dave Chinner <david@fromorbit.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 3/3] xfs: sb_spino_align is not verified
Date: Thu, 24 Oct 2024 09:55:44 -0700 [thread overview]
Message-ID: <20241024165544.GI21853@frogsfrogsfrogs> (raw)
In-Reply-To: <20241024025142.4082218-4-david@fromorbit.com>
On Thu, Oct 24, 2024 at 01:51:05PM +1100, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
>
> It's just read in from the superblock and used without doing any
> validity checks at all on the value.
>
> Fixes: fb4f2b4e5a82 ("xfs: add sparse inode chunk alignment superblock field")
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
Cc: <stable@vger.kernel.org> # v4.2
Oof yeah that's quite a gap!
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
--D
> ---
> fs/xfs/libxfs/xfs_sb.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/fs/xfs/libxfs/xfs_sb.c b/fs/xfs/libxfs/xfs_sb.c
> index d95409f3cba6..0d181bc140f0 100644
> --- a/fs/xfs/libxfs/xfs_sb.c
> +++ b/fs/xfs/libxfs/xfs_sb.c
> @@ -398,6 +398,20 @@ xfs_validate_sb_common(
> sbp->sb_inoalignmt, align);
> return -EINVAL;
> }
> +
> + if (!sbp->sb_spino_align ||
> + sbp->sb_spino_align > sbp->sb_inoalignmt ||
> + (sbp->sb_inoalignmt % sbp->sb_spino_align) != 0) {
> + xfs_warn(mp,
> + "Sparse inode alignment (%u) is invalid.",
> + sbp->sb_spino_align);
> + return -EINVAL;
> + }
> + } else if (sbp->sb_spino_align) {
> + xfs_warn(mp,
> + "Sparse inode alignment (%u) should be zero.",
> + sbp->sb_spino_align);
> + return -EINVAL;
> }
> } else if (sbp->sb_qflags & (XFS_PQUOTA_ENFD | XFS_GQUOTA_ENFD |
> XFS_PQUOTA_CHKD | XFS_GQUOTA_CHKD)) {
> --
> 2.45.2
>
>
next prev parent reply other threads:[~2024-10-24 16:55 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-24 2:51 [PATCH 0/3] xfs: sparse inodes overlap end of filesystem Dave Chinner
2024-10-24 2:51 ` [PATCH 1/3] xfs: fix sparse inode limits on runt AG Dave Chinner
2024-10-24 2:51 ` [PATCH 2/3] xfs: allow sparse inode records at the end of runt AGs Dave Chinner
2024-10-24 17:00 ` Darrick J. Wong
2024-10-25 6:43 ` Dave Chinner
2024-10-25 22:19 ` Darrick J. Wong
2024-10-26 21:47 ` Dave Chinner
2024-10-24 2:51 ` [PATCH 3/3] xfs: sb_spino_align is not verified Dave Chinner
2024-10-24 16:55 ` Darrick J. Wong [this message]
2024-10-25 6:33 ` Dave Chinner
2024-12-07 0:25 ` Luis Chamberlain
2024-12-07 0:32 ` Darrick J. Wong
2024-12-07 0:36 ` Luis Chamberlain
2024-12-07 11:34 ` Carlos Maiolino
2024-10-24 13:20 ` [PATCH 0/3] xfs: sparse inodes overlap end of filesystem Brian Foster
2024-10-25 0:48 ` Dave Chinner
2024-10-25 19:33 ` Brian Foster
2024-10-24 16:38 ` Darrick J. Wong
2024-10-25 6:29 ` Dave Chinner
2024-10-29 16:14 ` Eric Sandeen
2024-10-31 11:44 ` Carlos Maiolino
2024-10-31 20:45 ` Eric Sandeen
2024-10-31 22:13 ` Darrick J. Wong
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=20241024165544.GI21853@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.