From: ZhangPeng zhangpeng362@huawei.com
hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I6CAIM
--------------------------------
In some features of userfaultfd, vma->vm_userfaultfd_ctx.ctx may be NULL but VM_USWAP is not cleared. No longer check whether vma->vm_flags has VM_USWAP. Just remove the flag.
Signed-off-by: ZhangPeng zhangpeng362@huawei.com --- fs/userfaultfd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c index ec6e71ac66ad..dfa1a638640c 100644 --- a/fs/userfaultfd.c +++ b/fs/userfaultfd.c @@ -873,12 +873,12 @@ static int userfaultfd_release(struct inode *inode, struct file *file) prev = NULL; for (vma = mm->mmap; vma; vma = vma->vm_next) { userfault_flags = VM_UFFD_MISSING | VM_UFFD_WP; -#ifdef CONFIG_USERSWAP - uswap_release(&userfault_flags); -#endif cond_resched(); BUG_ON(!!vma->vm_userfaultfd_ctx.ctx ^ !!(vma->vm_flags & userfault_flags)); +#ifdef CONFIG_USERSWAP + uswap_release(&userfault_flags); +#endif if (vma->vm_userfaultfd_ctx.ctx != ctx) { prev = vma; continue;