From: "Zhou, Yun" <yun.zhou@windriver.com>
To: Longxing Li <coregee2000@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
syzkaller@googlegroups.com, willy@infradead.org,
linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, adilger.kernel@dilger.ca,
linux-ext4@vger.kernel.org
Subject: Re: [Kernel Bug] KASAN: slab-use-after-free Read in filemap_free_folio
Date: Wed, 15 Jul 2026 21:24:30 +0800 [thread overview]
Message-ID: <2bd30a23-3394-4d8f-b96f-8a56aaa3bb1b@windriver.com> (raw)
In-Reply-To: <CAHPqNmwSgLNVPycS5DCBJe0fiBhOzccBR6_A7wKUQCKQ4QeQyg@mail.gmail.com>
Hi,
On 7/2/2026 3:59 PM, Longxing Li wrote:
>
> Dear maintainers,
>
> I'm trying to fix this issue. The bug analysis and patch fix are as follows.
> ========================================================
> Bug Summary
>
> ext4_add_complete_io() queues i_rsv_conversion_work without holding an
> extra inode reference. If the inode is unlinked & evicted before the
> delayed work runs, ext4_do_flush_completed_IO() accesses a freed inode —
> use-after-free.
>
> ========================================================
> Fix
>
> Take igrab(inode) when first queueing the work (detected via
> list_empty check), and iput() after processing in
> ext4_do_flush_completed_IO(). A per-inode bit (i_rsv_need_iput) tracks
> whether the reference was taken.
>
> Changes:
> fs/ext4/ext4.h - add i_rsv_need_iput bit to struct ext4_inode_info
> fs/ext4/super.c - init the bit to 0 in ext4_alloc_inode()
> fs/ext4/page-io.c - igrab() before queue_work, iput() after flush
>
> Full patch is as follows and is attached in the link.
>
Although I'm also a newbie, I should point out that the way you're
sending the patch isn't quite right. You can just use the git send-email
command directly.
For example:
git send-email --to tytso@mit.edu --to adilger.kernel@dilger.ca --to
libaokun@linux.alibaba.com --to jack@suse.cz --to ojaswin@linux.ibm.com
--to ritesh.list@gmail.com --to yi.zhang@huawei.com --cc
linux-ext4@vger.kernel.org --cc linux-kernel@vger.kernel.org bug-fix.patch
If you're unsure which maintainers, reviewers, or mailing lists to send
a patch to, you can use the ./scripts/get_maintainer.pl script in the
source directory to find out.
Before sending, it's best to do thorough functional and regression
testing. You should also run the ./scripts/checkpatch.pl script to check
for any formatting issues in your patch. It's a good idea to read the
documentation in the Documentation/process/ directory first.
No rush, take your time. Feel free to ask me if you have any more questions.
Yun
prev parent reply other threads:[~2026-07-15 13:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CAHPqNmyHRaGj0fn+2FvvaJYi4WYOVmai6XX3bRCwbAZoj_GwWg@mail.gmail.com>
2026-02-02 14:14 ` [Kernel Bug] KASAN: slab-use-after-free Read in filemap_free_folio Matthew Wilcox
[not found] ` <CAHPqNmzacLWxDM4CSyEorgyh1tEyBfeOVr2gwUvUrtjZRCuh7A@mail.gmail.com>
[not found] ` <20260630131011.67546c6e472150e22c3e7c7c@linux-foundation.org>
2026-07-02 7:59 ` Longxing Li
2026-07-15 13:24 ` Zhou, Yun [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=2bd30a23-3394-4d8f-b96f-8a56aaa3bb1b@windriver.com \
--to=yun.zhou@windriver.com \
--cc=adilger.kernel@dilger.ca \
--cc=akpm@linux-foundation.org \
--cc=coregee2000@gmail.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=syzkaller@googlegroups.com \
--cc=willy@infradead.org \
/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