diff options
author | Darrick J. Wong <djwong@kernel.org> | 2023-06-29 19:15:45 +0200 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2023-07-03 18:48:17 +0200 |
commit | 2d7d1e7ea321b0b2810eb00183e21332ee9c4b6f (patch) | |
tree | e00f7799bc0b522fc99e9d3371d0e9f5d83c5475 /fs/xfs/xfs_extfree_item.c | |
parent | xfs: fix the calculation for "end" and "length" (diff) | |
download | linux-2d7d1e7ea321b0b2810eb00183e21332ee9c4b6f.tar.xz linux-2d7d1e7ea321b0b2810eb00183e21332ee9c4b6f.zip |
xfs: AGI length should be bounds checked
Similar to the recent patch strengthening the AGF agf_length
verification, the AGI verifier does not check that the AGI length field
is within known good bounds. This isn't currently checked by runtime
kernel code, yet we assume in many places that it is correct and verify
other metadata against it.
Add length verification to the AGI verifier. Just like the AGF length
checking, the length of the AGI must be equal to the size of the AG
specified in the superblock, unless it is the last AG in the filesystem.
In that case, it must be less than or equal to sb->sb_agblocks and
greater than XFS_MIN_AG_BLOCKS, which is the smallest AG a growfs
operation will allow to exist.
There's only one place in the filesystem that actually uses agi_length,
but let's not leave it vulnerable to the same weird nonsense that
generates syzbot bugs, eh?
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Diffstat (limited to 'fs/xfs/xfs_extfree_item.c')
0 files changed, 0 insertions, 0 deletions