]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm/shmem: fix race in shmem_undo_range w/THP
authorDavid Stevens <stevensd@chromium.org>
Tue, 18 Apr 2023 08:40:31 +0000 (17:40 +0900)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 20 Nov 2023 21:16:01 +0000 (13:16 -0800)
commit31a459f04109bf0b4d67d9cb2a0e94f0abbead94
tree463cf70aeca003d00e65ac989885aff534bee43a
parentac29673150d410cb551f6d7d0dd030aa0d465058
mm/shmem: fix race in shmem_undo_range w/THP

Split folios during the second loop of shmem_undo_range.  It's not
sufficient to only split folios when dealing with partial pages, since
it's possible for a THP to be faulted in after that point.  Calling
truncate_inode_folio in that situation can result in throwing away data
outside of the range being targeted.

Link: https://lkml.kernel.org/r/20230418084031.3439795-1-stevensd@google.com
Fixes: b9a8a4195c7d ("truncate,shmem: Handle truncates that split large folios")
Signed-off-by: David Stevens <stevensd@chromium.org>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Suleiman Souhlal <suleiman@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/shmem.c