]> git.itanic.dy.fi Git - linux-stable/commit
xfs: forbid AG btrees with level == 0
authorDarrick J. Wong <darrick.wong@oracle.com>
Mon, 9 Jan 2017 15:38:51 +0000 (16:38 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Jan 2017 10:39:42 +0000 (11:39 +0100)
commitb85f32481d93a23488d208fca4558e84515dc0f4
tree37fc914d5e42c633c1ac82b1db1ebb8a61065f6d
parent4081d4a79a95252486569b014b9a666ad5bfdbee
xfs: forbid AG btrees with level == 0

commit d2a047f31e86941fa896e0e3271536d50aba415e upstream.

There is no such thing as a zero-level AG btree since even a single-node
zero-records btree has one level.  Btree cursor constructors read
cur_nlevels straight from disk and then access things like
cur_bufs[cur_nlevels - 1] which is /really/ bad if cur_nlevels is zero!
Therefore, strengthen the verifiers to prevent this possibility.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/xfs/libxfs/xfs_alloc.c
fs/xfs/libxfs/xfs_ialloc.c