2023-09-18 20:08:12

by Jan Kara

[permalink] [raw]
Subject: Re: [PATCH] ext4: Fix incorrect offset

On Thu 24-08-23 23:23:24, Wang Jianjian wrote:
> The last argumen of ext4_check_dir_entry is dentry offset
^^^ argument

> int the file.
^^ in the directory

Maybe you could also add to the changelog: Luckily this error only results
in the wrong offset being printed in the eventual error message.

> Signed-off-by: Wang Jianjian <[email protected]>

Otherwise the fix looks good. Feel free to add:

Reviewed-by: Jan Kara <[email protected]>

Honza

> ---
> fs/ext4/namei.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
> index 94608b7df7e8..33ebd35025bf 100644
> --- a/fs/ext4/namei.c
> +++ b/fs/ext4/namei.c
> @@ -2261,8 +2261,7 @@ static int make_indexed_dir(handle_t *handle, struct ext4_filename *fname,
> top = data2 + len;
> while ((char *)(de2 = ext4_next_entry(de, blocksize)) < top) {
> if (ext4_check_dir_entry(dir, NULL, de, bh2, data2, len,
> - (data2 + (blocksize - csum_size) -
> - (char *) de))) {
> + (char *)de - data2)) {
> brelse(bh2);
> brelse(bh);
> return -EFSCORRUPTED;
> --
> 2.34.3
>
--
Jan Kara <[email protected]>
SUSE Labs, CR