All of lore.kernel.org
 help / color / mirror / Atom feed
* [merged mm-stable] mm-fix-list-corruption-in-put_pages_list.patch removed from -mm tree
@ 2024-03-12 20:07 Andrew Morton
  0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2024-03-12 20:07 UTC (permalink / raw)
  To: mm-commits, chaitanya.kumar.borah, willy, akpm


The quilt patch titled
     Subject: mm: fix list corruption in put_pages_list
has been removed from the -mm tree.  Its filename was
     mm-fix-list-corruption-in-put_pages_list.patch

This patch was dropped because it was merged into the mm-stable branch
of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Subject: mm: fix list corruption in put_pages_list
Date: Wed, 6 Mar 2024 21:27:30 +0000

My recent change to put_pages_list() dereferences folio->lru.next after
returning the folio to the page allocator.  Usually this is now on the pcp
list with other free folios, so we try to free an already-free folio. 
This only happens with lists that have more than 15 entries, so it wasn't
immediately discovered.  Revert to using list_for_each_safe() so we
dereference lru.next before disposing of the folio.

Link: https://lkml.kernel.org/r/20240306212749.1823380-1-willy@infradead.org
Fixes: 24835f899c01 ("mm: use free_unref_folios() in put_pages_list()")
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reported-by: "Borah, Chaitanya Kumar" <chaitanya.kumar.borah@intel.com>
Closes: https://lore.kernel.org/intel-gfx/SJ1PR11MB61292145F3B79DA58ADDDA63B9232@SJ1PR11MB6129.namprd11.prod.outlook.com/
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/swap.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/mm/swap.c~mm-fix-list-corruption-in-put_pages_list
+++ a/mm/swap.c
@@ -152,10 +152,10 @@ EXPORT_SYMBOL(__folio_put);
 void put_pages_list(struct list_head *pages)
 {
 	struct folio_batch fbatch;
-	struct folio *folio;
+	struct folio *folio, *next;
 
 	folio_batch_init(&fbatch);
-	list_for_each_entry(folio, pages, lru) {
+	list_for_each_entry_safe(folio, next, pages, lru) {
 		if (!folio_put_testzero(folio))
 			continue;
 		if (folio_test_large(folio)) {
_

Patches currently in -mm which might be from willy@infradead.org are



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-03-12 20:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-12 20:07 [merged mm-stable] mm-fix-list-corruption-in-put_pages_list.patch removed from -mm tree Andrew Morton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.