]> git.baikalelectronics.ru Git - kernel.git/commit
mm/swap: fix pte_same_as_swp() not removing uffd-wp bit when compare
authorPeter Xu <peterx@redhat.com>
Wed, 16 Jun 2021 01:23:16 +0000 (18:23 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 16 Jun 2021 16:24:42 +0000 (09:24 -0700)
commit38e689208d6dc52a989dac5b141c8520a6fc50da
treeb6088a641393719d3fd835cd9a0c346ba7c54b30
parentb6bd0c534590fcaee0040c8975a5d2ae4cfe9a3b
mm/swap: fix pte_same_as_swp() not removing uffd-wp bit when compare

I found it by pure code review, that pte_same_as_swp() of unuse_vma()
didn't take uffd-wp bit into account when comparing ptes.
pte_same_as_swp() returning false negative could cause failure to
swapoff swap ptes that was wr-protected by userfaultfd.

Link: https://lkml.kernel.org/r/20210603180546.9083-1-peterx@redhat.com
Fixes: 51923875c870 ("userfaultfd: wp: support swap and page migration")
Signed-off-by: Peter Xu <peterx@redhat.com>
Acked-by: Hugh Dickins <hughd@google.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: <stable@vger.kernel.org> [5.7+]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/swapops.h
mm/swapfile.c