]> git.baikalelectronics.ru Git - kernel.git/commit
shmem: update folio if shmem_replace_page() updates the page
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Sat, 30 Jul 2022 04:25:18 +0000 (05:25 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Sun, 28 Aug 2022 21:02:43 +0000 (14:02 -0700)
commit75ed33e12a1c56c6e939156a5ac156dc38cebed0
tree70a926c1eb27480f540a86768dda9eaa46bedce8
parentfde5888ad27a0b15142ee7028a8a9d2a7c6bc426
shmem: update folio if shmem_replace_page() updates the page

If we allocate a new page, we need to make sure that our folio matches
that new page.

If we do end up in this code path, we store the wrong page in the shmem
inode's page cache, and I would rather imagine that data corruption
ensues.

This will be solved by changing shmem_replace_page() to
shmem_replace_folio(), but this is the minimal fix.

Link: https://lkml.kernel.org/r/20220730042518.1264767-1-willy@infradead.org
Fixes: 0e01d2697a7d ("mm/shmem: convert shmem_swapin_page() to shmem_swapin_folio()")
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: William Kucharski <william.kucharski@oracle.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/shmem.c