[PATCH] xfs: don't perform lookups on zero-height btrees
Brian Foster
bfoster at redhat.com
Wed Aug 24 13:01:55 CDT 2016
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 at 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 at oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
More information about the xfs
mailing list