[PATCH 0/4] ocfs2: consolidate extent list validation into block read callbacks
From: Joseph Qi
Date: Fri Apr 03 2026 - 05:09:48 EST
ocfs2 validates extent list fields (l_count, l_next_free_rec) at various
points during extent tree traversal. This is fragile because each caller
must remember to check for corrupted on-disk data before using it.
This series moves those checks into the block read validation callbacks
(ocfs2_validate_dx_root and ocfs2_validate_extent_block), so corrupted
fields are caught early at block read time. Redundant post-read checks
are then removed.
Patch 1-2 handle the dx_root extent list:
- Move l_count and l_next_free_rec validation into
ocfs2_validate_dx_root(), skipping inline dx roots.
- Remove the now-redundant l_next_free_rec == 0 check in
ocfs2_dx_dir_lookup_rec() and rework the error message to avoid a
potential NULL pointer dereference of rec.
Patch 3-4 handle extent blocks:
- Add l_count and l_next_free_rec validation to
ocfs2_validate_extent_block().
- Remove the duplicate l_next_free_rec > l_count check in
__ocfs2_find_path().
Joseph Qi (4):
ocfs2: validate dx_root extent list fields during block read
ocfs2: remove empty extent list check in ocfs2_dx_dir_lookup_rec()
ocfs2: validate extent block list fields during block read
ocfs2: remove redundant l_next_free_rec check in __ocfs2_find_path()
fs/ocfs2/alloc.c | 35 +++++++++++++++++++++-------------
fs/ocfs2/dir.c | 49 +++++++++++++++++++++++++++---------------------
2 files changed, 50 insertions(+), 34 deletions(-)
--
2.39.3