mm/memory-failure.c: catch unexpected -EFAULT from vma_address()
authorMiaohe Lin <linmiaohe@huawei.com>
Mon, 28 Feb 2022 23:01:07 +0000 (10:01 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Mon, 28 Feb 2022 23:01:07 +0000 (10:01 +1100)
commitdf12b4814afe1c34a1339aafd131d6b274f1e547
tree29fbc4eb6b24f877083c39287416bb7e583ef3f0
parent8fa0bab0989a7eb9f3e8584ffe9f4155154b7333
mm/memory-failure.c: catch unexpected -EFAULT from vma_address()

It's unexpected to walk the page table when vma_address() return -EFAULT.
But dev_pagemap_mapping_shift() is called only when vma associated to the
error page is found already in collect_procs_{file,anon}, so vma_address()
should not return -EFAULT except with some bug, as Naoya pointed out.  We
can use VM_BUG_ON_VMA() to catch this bug here.

Link: https://lkml.kernel.org/r/20220218090118.1105-3-linmiaohe@huawei.com
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Acked-by: Naoya Horiguchi <naoya.horiguchi@nec.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
mm/memory-failure.c