diff options
| author | 2026-04-13 19:43:11 +0100 | |
|---|---|---|
| committer | 2026-04-22 13:32:21 +0200 | |
| commit | c330e65ea59c4805d6ab6757c4ddfe8c63acef31 (patch) | |
| tree | c27ed295f01c884647cdb1e5be43830f08ce7f90 /scripts/kconfig/tests/err_recursive_dep/git:/ssh:/git@git.zx2c4.com | |
| parent | KVM: SEV: Drop WARN on large size for KVM_MEMORY_ENCRYPT_REG_REGION (diff) | |
mm: call ->free_folio() directly in folio_unmap_invalidate()
commit 615d9bb2ccad42f9e21d837431e401db2e471195 upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'scripts/kconfig/tests/err_recursive_dep/git:/ssh:/git@git.zx2c4.com')
0 files changed, 0 insertions, 0 deletions
