From: Christoph Hellwig <hch@infradead.org>
To: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Jan Kara <jack@suse.cz>,
linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
Jens Axboe <axboe@kernel.dk>,
stable@vger.kernel.org,
Google Big Sleep
<big-sleep-vuln-reports+bigsleep-501448199@google.com>
Subject: Re: [PATCH] mm: Call ->free_folio() directly in folio_unmap_invalidate()
Date: Tue, 14 Apr 2026 00:48:08 -0700 [thread overview]
Message-ID: <ad3xOI71tU2Uofo_@infradead.org> (raw)
In-Reply-To: <20260413184314.3419945-1-willy@infradead.org>
On Mon, Apr 13, 2026 at 07:43:11PM +0100, Matthew Wilcox (Oracle) wrote:
> We can only call filemap_free_folio() if we have a reference to (or hold a
> lock on) the mapping. Otherwise, we've already removed the folio from the
> mapping so it no longer pins the mapping and the mapping can be removed,
> causing a use-after-free when accessing mapping->a_ops.
>
> Follow the same pattern as __remove_mapping() and load the free_folio
> function pointer before dropping the lock on the mapping. That lets
> us make filemap_free_folio() static as this was the only caller outside
> filemap.c.
>
> Fixes: 4a9e23159fd3 (mm/truncate: add folio_unmap_invalidate() helper)
That commit just consolidated code, but did not change the locking
assumptions, and did in fact not touch this part of the code at all
despite moving it into a new helper. So I don't it this is the
culprit.
next prev parent reply other threads:[~2026-04-14 7:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-13 18:43 Matthew Wilcox (Oracle)
2026-04-14 7:48 ` Christoph Hellwig [this message]
2026-04-14 12:28 ` Jan Kara
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=ad3xOI71tU2Uofo_@infradead.org \
--to=hch@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=big-sleep-vuln-reports+bigsleep-501448199@google.com \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=stable@vger.kernel.org \
--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