From: Greg KH <gregkh@linuxfoundation.org>
To: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Cc: stable@vger.kernel.org,
Google Big Sleep
<big-sleep-vuln-reports+bigsleep-501448199@google.com>,
Jens Axboe <axboe@kernel.dk>, Jan Kara <jack@suse.cz>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 6.18.y] mm: call ->free_folio() directly in folio_unmap_invalidate()
Date: Thu, 23 Apr 2026 10:57:21 +0200 [thread overview]
Message-ID: <2026042345-t-shirt-december-6836@gregkh> (raw)
In-Reply-To: <20260420145343.2046992-1-willy@infradead.org>
On Mon, Apr 20, 2026 at 03:53:43PM +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.
>
> Link: https://lore.kernel.org/20260413184314.3419945-1-willy@infradead.org
> Fixes: fb7d3bc41493 ("mm/filemap: drop streaming/uncached pages when writeback completes")
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> Reported-by: Google Big Sleep <big-sleep-vuln-reports+bigsleep-501448199@google.com>
> Cc: Jens Axboe <axboe@kernel.dk>
> Cc: Jan Kara <jack@suse.cz>
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> (cherry picked from commit 615d9bb2ccad42f9e21d837431e401db2e471195)
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---
> mm/filemap.c | 3 ++-
> mm/internal.h | 1 -
> mm/truncate.c | 6 +++++-
> 3 files changed, 7 insertions(+), 3 deletions(-)
This is odd, it's applying with a ton of fuzz, which puts things in the
wrong functions and breaks the build. Let me go fix it up by hand...
thanks,
greg k-h
next prev parent reply other threads:[~2026-04-23 8:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-20 13:09 FAILED: patch "[PATCH] mm: call ->free_folio() directly in folio_unmap_invalidate()" failed to apply to 6.18-stable tree gregkh
2026-04-20 14:53 ` [PATCH 6.18.y] mm: call ->free_folio() directly in folio_unmap_invalidate() Matthew Wilcox (Oracle)
2026-04-23 8:57 ` Greg KH [this message]
2026-04-23 8:59 ` Greg KH
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=2026042345-t-shirt-december-6836@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=big-sleep-vuln-reports+bigsleep-501448199@google.com \
--cc=jack@suse.cz \
--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