mirror of
https://github.com/torvalds/linux.git
synced 2026-09-13 15:40:03 +02:00
xfs: assert the reservation covers each da fork growth
xfs_da_grow_inode_int() subtracts the blocks it just allocated from args->total, the caller's remaining block reservation. The subtraction is unsigned, so a caller that reaches it with too small a total wraps the field instead of failing, and every allocation afterwards runs with a bogus reservation. Assert the remaining reservation still covers the step, so an under-reserved or uninitialised total trips in debug builds instead of silently wrapping. Suggested-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Javier Tia <floss@jetm.me> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Carlos Maiolino <cem@kernel.org>
This commit is contained in:
parent
8e4ebb6afa
commit
0fe77e5758
|
|
@ -2384,6 +2384,7 @@ xfs_da_grow_inode_int(
|
|||
}
|
||||
|
||||
/* account for newly allocated blocks in reserved blocks total */
|
||||
ASSERT(args->total >= dp->i_nblocks - nblks);
|
||||
args->total -= dp->i_nblocks - nblks;
|
||||
|
||||
out_free_map:
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user