Re: [PATCH v3] fat: stop reading directory entries past the end-of-directory marker
From: OGAWA Hirofumi
Date: Tue Jun 16 2026 - 10:56:49 EST
OGAWA Hirofumi <hirofumi@xxxxxxxxxxxxxxxxxx> writes:
>
> There are some strange behavior though (e.g. seek after name[0] == 0,
> then readdir()), the strange should only be on already a corrupted image.
>
> Well, if we found a serious issue with this, there is possibility to
> revert later though. Looks good for me.
>
> Acked-by: OGAWA Hirofumi <hirofumi@xxxxxxxxxxxxxxxxxx>
>
[...]
>> +static int fat_get_entry_eod(struct inode *dir, loff_t *pos,
>> + struct buffer_head **bh,
>> + struct msdos_dir_entry **de)
>> +{
>> + int err = fat_get_entry(dir, pos, bh, de);
>> +
>> + if (err == 0 && (*de)->name[0] == 0) {
>> + *pos = dir->i_size;
I re-reviewed this part. Since here is failure case, so we have to
release *bh, isn't it?
brelse(*bh);
*bh = NULL;
>> + return -1;
>> + }
>> + return err;
--
OGAWA Hirofumi <hirofumi@xxxxxxxxxxxxxxxxxx>