mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Baokun Li <libaokun1@huawei.com>
To: Theodore Ts'o <tytso@mit.edu>, Edward Adam Davis <eadavis@qq.com>
Cc: <syzbot+ae688d469e36fb5138d0@syzkaller.appspotmail.com>,
	<adilger.kernel@dilger.ca>, <linux-ext4@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <syzkaller-bugs@googlegroups.com>
Subject: Re: [PATCH] ext4: No need to continue when the number of entries is 1
Date: Fri, 23 Aug 2024 10:22:19 +0800	[thread overview]
Message-ID: <6ba9afc8-fa95-478c-8ed2-a4ad10b3c520@huawei.com> (raw)
In-Reply-To: <172433877725.370733.2330809797744892142.b4-ty@mit.edu>

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


  reply	other threads:[~2024-08-23  2:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-29 10:05 [syzbot] [ext4?] BUG: unable to handle kernel paging request in do_split syzbot
2024-06-30  9:09 ` Edward Adam Davis
2024-06-30  9:33   ` syzbot
2024-07-01 14:25 ` [PATCH] ext4: No need to continue when the number of entries is 1 Edward Adam Davis
2024-08-22 15:00   ` Theodore Ts'o
2024-08-23  2:22     ` Baokun Li [this message]
2024-08-23 16:05       ` Theodore Ts'o
2024-08-24  4:20         ` Baokun Li
2024-07-01 14:36 ` [syzbot] [ext4?] BUG: unable to handle kernel paging request in do_split Baokun Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6ba9afc8-fa95-478c-8ed2-a4ad10b3c520@huawei.com \
    --to=libaokun1@huawei.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=eadavis@qq.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+ae688d469e36fb5138d0@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®