On 7/2/25 6:23 PM, Darrick J. Wong wrote:
Why wouldn't you encode this check in __ext4_check_dir_entry and solve this problem for all the callsites?
Next thing to try indeed. BTW, looking through ext4_search_dir(), why the search doesn't actually start from the specified offset? I.e. shouldn't it be: diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index a178ac229489..8aa0d68dae71 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -1461,7 +1461,7 @@ int ext4_search_dir(struct buffer_head *bh, char *search_buf, int buf_size, char * dlimit; int de_len; - de = (struct ext4_dir_entry_2 *)search_buf; + de = (struct ext4_dir_entry_2 *)search_buf + offset; dlimit = search_buf + buf_size; while ((char *) de < dlimit - EXT4_BASE_DIR_LEN) { /* this code is executed quadratically often */ Dmitry