mm/thp: fix page_address_in_vma() on file THP tails

Anon THP tails were already supported, but memory-failure may need to
use page_address_in_vma() on file THP tails, which its page->mapping
check did not permit: fix it.

hughd adds: no current usage is known to hit the issue, but this does
fix a subtle trap in a general helper: best fixed in stable sooner than

Fixes: 800d8c63b2e9 ("shmem: add huge pages support")
Signed-off-by: Jue Wang <>
Signed-off-by: Hugh Dickins <>
Reviewed-by: Matthew Wilcox (Oracle) <>
Reviewed-by: Yang Shi <>
Acked-by: Kirill A. Shutemov <>
Cc: Alistair Popple <>
Cc: Jan Kara <>
Cc: Miaohe Lin <>
Cc: Minchan Kim <>
Cc: Naoya Horiguchi <>
Cc: Oscar Salvador <>
Cc: Peter Xu <>
Cc: Ralph Campbell <>
Cc: Shakeel Butt <>
Cc: Wang Yugui <>
Cc: Zi Yan <>
Cc: <>
Signed-off-by: Andrew Morton <>
Signed-off-by: Linus Torvalds <>
1 file changed