From: sashiko-bot@kernel.org
To: "Jiahao Xu" <xujiahao@cmss.chinamobile.com>
Cc: linux-ext4@vger.kernel.org, tytso@mit.edu
Subject: Re: [PATCH] ext4: fix out-of-bounds read in ext4_inlinedir_to_tree()
Date: Thu, 12 Nov 2026 01:40:27 +0000 [thread overview]
Message-ID: <sashiko-outbox-210081@kernel.org> (raw)
In-Reply-To: <20261112091303.723243-1-xujiahao@cmss.chinamobile.com>
> ext4_inlinedir_to_tree() reads the on-disk dirent hash trailer without
> checking that it lies inside the inline directory payload:
>
> if (ext4_hash_in_dirent(dir)) {
> hinfo->hash = EXT4_DIRENT_HASH(de);
> hinfo->minor_hash = EXT4_DIRENT_MINOR_HASH(de);
> }
>
> EXT4_DIRENT_HASHES() derives the offset of the trailer from
> de->name_len alone, so for an entry whose rec_len ends exactly at
> inline_size the read starts past the kmalloc(inline_size) buffer that
> holds the payload. Listing such an image with getdents64() gives:
>
> BUG: KASAN: slab-out-of-bounds in ext4_inlinedir_to_tree+0xb6c/0xc00
> Read of size 4 at addr ffff8880052496bc by task init/1
> [ ... ]
> Fixes: 471fbbea7ff7 ("ext4: handle casefolding with encryption")
> Reported-by: Guikun Yang <yangguikun19@qq.com>
> Closes: https://lore.kernel.org/all/tencent_4F47889D184C7FA2287DC2A33A52F3BE9F09@qq.com/
> Cc: stable@vger.kernel.org
> Signed-off-by: Jiahao Xu <xujiahao@cmss.chinamobile.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261112091303.723243-1-xujiahao@cmss.chinamobile.com?part=1
prev parent reply other threads:[~2026-11-12 1:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 10:00 [Bug report] ext4: unvalidated hash trailer read past a fake dirent in ext4_inlinedir_to_tree() Guikun Yang
2026-11-12 1:13 ` [PATCH] ext4: fix out-of-bounds read " Jiahao Xu
2026-11-12 1:40 ` sashiko-bot [this message]
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=sashiko-outbox-210081@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=tytso@mit.edu \
--cc=xujiahao@cmss.chinamobile.com \
/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