Re: [PATCH v4 2/2] f2fs: Add sanity checks before unlinking and loading inodes

From: Chao Yu

Date: Wed Nov 05 2025 - 06:14:54 EST


On 11/5/25 19:09, Nikola Z. Ivanov wrote:
> Add check for inode->i_nlink == 1 for directories during unlink,
> as their value is decremented twice, which can trigger a warning in
> drop_nlink. In such case mark the filesystem as corrupted and return
> from the function call with the relevant failure return value.
>
> Additionally add the check for i_nlink == 1 in
> sanity_check_inode in order to detect on-disk corruption early.
>
> Reported-by: syzbot+c07d47c7bc68f47b9083@xxxxxxxxxxxxxxxxxxxxxxxxx
> Closes: https://syzkaller.appspot.com/bug?extid=c07d47c7bc68f47b9083
> Tested-by: syzbot+c07d47c7bc68f47b9083@xxxxxxxxxxxxxxxxxxxxxxxxx
> Signed-off-by: Nikola Z. Ivanov <zlatistiv@xxxxxxxxx>

Reviewed-by: Chao Yu <chao@xxxxxxxxxx>

Thanks,