Re: [PATCH] vfat: fix uninitialized i_pos error

From: OGAWA Hirofumi
Date: Tue Aug 19 2025 - 11:37:03 EST


zhoumin <teczm@xxxxxxxxxxx> writes:

> The i_pos field remains uninitialized when fat_fs_error_ratelimit() reports
> error, e.g.,
>
> [ 1642.703550] FAT-fs (loop0): error, fat_get_cluster: invalid
> cluster chain (i_pos 0)
>
> Since i_pos is assigned in fat_attach after fat_fill_inode, the error
> message lacks useful debug info.
>
> Path:
> vfat_lookup
> fat_build_inode
> fat_fill_inode
> fat_calc_dir_size
> fat_get_cluster /* report error */
> fat_attach /* i_pos assigned here */

No. It is initialized as 0, and it must be unavailable outside
between fat_attach and fat_detach.

IOW, this is introducing the race.

Thanks.
--
OGAWA Hirofumi <hirofumi@xxxxxxxxxxxxxxxxxx>