From: Brian Foster <bfoster@redhat.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-xfs@vger.kernel.org, xfs@oss.sgi.com
Subject: Re: [PATCH] xfs: don't perform lookups on zero-height btrees
Date: Wed, 24 Aug 2016 14:01:55 -0400 [thread overview]
Message-ID: <20160824180154.GA8982@bfoster.bfoster> (raw)
In-Reply-To: <20160819203022.GD8268@birch.djwong.org>
On Fri, Aug 19, 2016 at 01:30:22PM -0700, Darrick J. Wong wrote:
> If the caller passes in a cursor to a zero-height btree (which is
> impossible), we never set block to anything but NULL, which causes the
> later dereference of it to crash. Instead, just return -EFSCORRUPTED.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
Did something actually cause this to happen?
Brian
> fs/xfs/libxfs/xfs_btree.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/fs/xfs/libxfs/xfs_btree.c b/fs/xfs/libxfs/xfs_btree.c
> index 64fd847..4bffea4 100644
> --- a/fs/xfs/libxfs/xfs_btree.c
> +++ b/fs/xfs/libxfs/xfs_btree.c
> @@ -1814,6 +1814,10 @@ xfs_btree_lookup(
>
> XFS_BTREE_STATS_INC(cur, lookup);
>
> + /* No such thing as a zero-level tree. */
> + if (cur->bc_nlevels == 0)
> + return -EFSCORRUPTED;
> +
> block = NULL;
> keyno = 0;
>
>
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2016-08-24 18:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-19 20:30 [PATCH] xfs: don't perform lookups on zero-height btrees Darrick J. Wong
2016-08-24 18:01 ` Brian Foster [this message]
2016-08-24 20:39 ` Darrick J. Wong
2016-08-25 8:04 ` Christoph Hellwig
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=20160824180154.GA8982@bfoster.bfoster \
--to=bfoster@redhat.com \
--cc=darrick.wong@oracle.com \
--cc=linux-xfs@vger.kernel.org \
--cc=xfs@oss.sgi.com \
/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