mm: Remove bogus VM_BUG_ON
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Wed, 18 Aug 2021 14:43:41 +0000 (10:43 -0400)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Sun, 3 Oct 2021 10:56:47 +0000 (06:56 -0400)
It is not safe to check page->index without holding the page lock.
It can be changed if the page is moved between the swap cache and the
page cache for a shmem file, for example.  There is a VM_BUG_ON below
which checks page->index is correct after taking the page lock.

Cc: stable@vger.kernel.org
Fixes: 5c211ba29deb ("mm: add and use find_lock_entries")
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
mm/filemap.c

index dae481293b5d95742bf440351d0a79e5f95e9384..82a17c35eb96bcd4155d783f544a52a70269b1a7 100644 (file)
@@ -2093,7 +2093,6 @@ unsigned find_lock_entries(struct address_space *mapping, pgoff_t start,
                if (!xa_is_value(page)) {
                        if (page->index < start)
                                goto put;
-                       VM_BUG_ON_PAGE(page->index != xas.xa_index, page);
                        if (page->index + thp_nr_pages(page) - 1 > end)
                                goto put;
                        if (!trylock_page(page))