Skip to content

ocfs2: consolidate extent list validation into block read callbacks

Joseph Qi lkml ocfs2-devel 1 version Applied

Status from this message: [merged mm-nonmm-stable] ocfs2-remove-redundant-l_next_free_rec-check-in-__ocfs2_find_path.patch removed from -mm tree

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 6 repliesApplied 4/4

Patches in v1 All 4 applied

#Subject and filesSizeRepliesApplied
1/4ocfs2: validate dx_root extent list fields during block readfs/ocfs2/dir.c+25 -91 replyApplied
2/4ocfs2: remove empty extent list check in ocfs2_dx_dir_lookup_rec()fs/ocfs2/dir.c+3 -121 replyApplied
3/4ocfs2: validate extent block list fields during block readfs/ocfs2/alloc.c+22 -11 replyApplied
4/4ocfs2: remove redundant l_next_free_rec check in __ocfs2_find_path()fs/ocfs2/alloc.c+0 -121 replyApplied

Reviews trailers per patch

All 4 patches have a Reviewed-by or Acked-by.

PatchHeming Zhao
1/4R-b
2/4R-b
3/4R-b
4/4R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/4] ocfs2: consolidate extent list validation into block read callbacks

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(-)
Signature · 1 line
2.39.3