mirror of
https://github.com/torvalds/linux.git
synced 2026-09-13 15:40:03 +02:00
xfs: strengthen the "is cow staging" helpers in scrub
LOLLM pointed out a bug in both of the refcount scrub predicates that
determine if a range of blocks is marked as CoW staging in the btree.
While it compares blockcount < len, this isn't enough to determine that
the CoW staging record is at least as large as the range passed into the
helper. Fix both of them.
Cc: stable@vger.kernel.org # v4.16
Fixes: f6d5fc21fd ("xfs: cross-reference refcount btree during scrub")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Assisted-by: LOLLM # finding obvious bugs
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
This commit is contained in:
parent
c3085f6c7c
commit
0d43368844
|
|
@ -581,8 +581,12 @@ xchk_xref_is_cow_staging(
|
|||
if (rc.rc_domain != XFS_REFC_DOMAIN_COW)
|
||||
xchk_btree_xref_set_corrupt(sc, sc->sa.refc_cur, 0);
|
||||
|
||||
/* Can't start after bno */
|
||||
if (rc.rc_startblock > agbno)
|
||||
xchk_btree_xref_set_corrupt(sc, sc->sa.refc_cur, 0);
|
||||
|
||||
/* Must be at least as long as what was passed in */
|
||||
if (rc.rc_blockcount < len)
|
||||
if (rc.rc_startblock + rc.rc_blockcount < agbno + len)
|
||||
xchk_btree_xref_set_corrupt(sc, sc->sa.refc_cur, 0);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -609,8 +609,12 @@ xchk_xref_is_rt_cow_staging(
|
|||
if (rc.rc_domain != XFS_REFC_DOMAIN_COW)
|
||||
xchk_btree_xref_set_corrupt(sc, sc->sr.refc_cur, 0);
|
||||
|
||||
/* Can't start after bno */
|
||||
if (rc.rc_startblock > bno)
|
||||
xchk_btree_xref_set_corrupt(sc, sc->sr.refc_cur, 0);
|
||||
|
||||
/* Must be at least as long as what was passed in */
|
||||
if (rc.rc_blockcount < len)
|
||||
if (rc.rc_startblock + rc.rc_blockcount < bno + len)
|
||||
xchk_btree_xref_set_corrupt(sc, sc->sr.refc_cur, 0);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user