From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 2/2] xfs: check da node magic in _node_lookup_int
Date: Wed, 1 Aug 2018 07:15:24 -0700 [thread overview]
Message-ID: <20180801141524.GB30972@magnolia> (raw)
In-Reply-To: <20180801121202.2nk4qwwizmvhla57@odin.usersys.redhat.com>
On Wed, Aug 01, 2018 at 02:12:02PM +0200, Carlos Maiolino wrote:
> On Tue, Jul 31, 2018 at 04:21:00PM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <darrick.wong@oracle.com>
> >
> > Before we start processing what we /think/ is a da3 node block, actually
> > check the magic to make sure that we're looking at a node block. This
> > way we won't blow the asserts in _node_hdr_from_disk on corrupted
> > metadata.
> >
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
>
> The patch looks good, but why wouldn't merge it into the previous one?
>
> Both patches look reasonable to fit into a single one.
>
> But, merging both or not.
They're different logical changes to the source code -- one refactors to
use a local variable, the other adds extra checks.
--D
> Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
>
> > ---
> > fs/xfs/libxfs/xfs_da_btree.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> >
> > diff --git a/fs/xfs/libxfs/xfs_da_btree.c b/fs/xfs/libxfs/xfs_da_btree.c
> > index 8ffe17b223da..376bee94b5dd 100644
> > --- a/fs/xfs/libxfs/xfs_da_btree.c
> > +++ b/fs/xfs/libxfs/xfs_da_btree.c
> > @@ -1523,8 +1523,10 @@ xfs_da3_node_lookup_int(
> > break;
> > }
> >
> > - blk->magic = XFS_DA_NODE_MAGIC;
> > + if (magic != XFS_DA_NODE_MAGIC && magic != XFS_DA3_NODE_MAGIC)
> > + return -EFSCORRUPTED;
> >
> > + blk->magic = XFS_DA_NODE_MAGIC;
> >
> > /*
> > * Search an intermediate node for a match.
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
>
> --
> Carlos
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2018-08-01 16:01 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-31 23:20 [PATCH 1/2] xfs: use a local variable for magic number in xfs_da3_node_lookup_int Darrick J. Wong
2018-07-31 23:21 ` [PATCH 2/2] xfs: check da node magic in _node_lookup_int Darrick J. Wong
2018-08-01 12:07 ` Brian Foster
2018-08-01 12:12 ` Carlos Maiolino
2018-08-01 14:15 ` Darrick J. Wong [this message]
2018-08-02 9:38 ` Carlos Maiolino
2018-08-01 12:07 ` [PATCH 1/2] xfs: use a local variable for magic number in xfs_da3_node_lookup_int Brian Foster
2018-08-01 12:10 ` Carlos Maiolino
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=20180801141524.GB30972@magnolia \
--to=darrick.wong@oracle.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;
as well as URLs for NNTP newsgroup(s).