Matthew Wilcox (Oracle) b555895c31 mm: fix list corruption in put_pages_list
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>
2024-03-12 13:07:16 -07:00
..
2024-03-06 13:04:18 -08:00
2023-12-12 10:11:32 +01:00
2023-04-12 17:36:23 -07:00
2022-10-03 14:02:43 -07:00
2024-02-22 10:24:52 -08:00
2024-02-21 16:00:03 -08:00
2024-02-23 17:48:19 -08:00
2021-05-07 00:26:35 -07:00
2023-04-12 17:36:23 -07:00