[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6ba9afc8-fa95-478c-8ed2-a4ad10b3c520@huawei.com>
Date: Fri, 23 Aug 2024 10:22:19 +0800
From: Baokun Li <libaokun1@...wei.com>
To: Theodore Ts'o <tytso@....edu>, Edward Adam Davis <eadavis@...com>
CC: <syzbot+ae688d469e36fb5138d0@...kaller.appspotmail.com>,
<adilger.kernel@...ger.ca>, <linux-ext4@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <syzkaller-bugs@...glegroups.com>
Subject: Re: [PATCH] ext4: No need to continue when the number of entries is 1
On 2024/8/22 23:00, Theodore Ts'o wrote:
> On Mon, 01 Jul 2024 22:25:03 +0800, Edward Adam Davis wrote:
>> When the number of entries mapped is 1, there is no need to split it.
>>
>>
> Applied, thanks!
>
> [1/1] ext4: No need to continue when the number of entries is 1
> commit: b2b81e122b5616890ba6657adeb8aa5ca1f05fe2
>
> Best regards,
Hi Ted,
I think this patch is wrong and it will hide the real problem.
The maximum length of a filename is 255 and the minimum block size is 1024,
so it is always guaranteed that the number of entries is greater than or
equal to 2 when do_split() is called.
The problem reported by syzbot was actually caused by a missing check in
make_indexed_dir(). The issue has been fixed:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=50ea741def58
So unless ext4_dx_add_entry() and make_indexed_dir(), or some other function
has a bug, 'split == 0' will not occur.
If we want to defend against future changes that introduce bugs, I think
it's better to add a WARN_ON_ONCE to make sure that the problem isn't hidden
and that it doesn't trigger serious bugs like out-of-bounds access.
continued = WARN_ON_ONCE(split == 0) ? 0 : hash2 == map[split - 1].hash;
--
With Best Regards,
Baokun Li
Powered by blists - more mailing lists