Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

filemap: update offset check in filemap_fault()

With THP, current check of offset:

VM_BUG_ON_PAGE(page->index != offset, page);

is no longer accurate. Update it to:

VM_BUG_ON_PAGE(page_to_pgoff(page) != offset, page);

Link: http://lkml.kernel.org/r/20190801184244.3169074-4-songliubraving@fb.com
Signed-off-by: Song Liu <songliubraving@fb.com>
Acked-by: Rik van Riel <riel@surriel.com>
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Hillf Danton <hdanton@sina.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: William Kucharski <william.kucharski@oracle.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Song Liu and committed by
Linus Torvalds
520e5ba4 31895438

+1 -1
+1 -1
mm/filemap.c
··· 2545 2545 put_page(page); 2546 2546 goto retry_find; 2547 2547 } 2548 - VM_BUG_ON_PAGE(page->index != offset, page); 2548 + VM_BUG_ON_PAGE(page_to_pgoff(page) != offset, page); 2549 2549 2550 2550 /* 2551 2551 * We have a locked page in the page cache, now we need to check