Re: [PATCH] fat: validate dotdot buffers in VFAT and MSDOS rename and rollback
From: Krystian Kaniewski
Date: Wed Sep 30 2026 - 08:23:56 EST
On 9/30/26 10:02, OGAWA Hirofumi wrote:
>> diff --git a/fs/fat/dir.c b/fs/fat/dir.c
>> index 35bdb6294..cee06e635 100644
>> --- a/fs/fat/dir.c
>> +++ b/fs/fat/dir.c
>> @@ -941,6 +941,40 @@ int fat_get_dotdot_entry(struct inode *dir, struct buffer_head **bh,
>> }
>> EXPORT_SYMBOL_GPL(fat_get_dotdot_entry);
>>
>> +static int __fat_update_dotdot_de(struct inode *dir, struct inode *inode,
>> + struct buffer_head *dotdot_bh,
>> + struct msdos_dir_entry *dotdot_de,
>> + bool force_sync)
>> +{
>> + lock_buffer(dotdot_bh);
>
> This looks like unnecessarily wait the completion of buffer I/O, isn't
> it? I guess, it is ok to give up to revert if surely I/O error, because
> the reverted buffer will be the I/O error again.
>
> Thanks.
>
Indeed, lock_buffer() may be a bit of an overkill here. I’ll rework the patch to track the buffer whose synchronous write failed and skip rollback operations that would modify the same buffer, while still rolling back entries stored in other buffers.
Thanks for the suggestion.
--
Krystian Kaniewski