lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Date:   Mon, 1 Jun 2020 19:55:21 +0800
From:   linmiaohe <linmiaohe@...wei.com>
To:     <viro@...iv.linux.org.uk>
CC:     <linux-fsdevel@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <linmiaohe@...wei.com>
Subject: [PATCH] userfaultfd: eliminate meaningless check in userfaultfd_register()

From: Miaohe Lin <linmiaohe@...wei.com>

When we reach here, !(cur->vm_flags & VM_MAYWRITE) is already checked and
equals to false. So the condition here always equals to false and should
be eliminated.

Signed-off-by: Miaohe Lin <linmiaohe@...wei.com>
---
 fs/userfaultfd.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c
index e39fdec8a0b0..e529e6bbb57b 100644
--- a/fs/userfaultfd.c
+++ b/fs/userfaultfd.c
@@ -1409,8 +1409,6 @@ static int userfaultfd_register(struct userfaultfd_ctx *ctx,
 			if (end & (vma_hpagesize - 1))
 				goto out_unlock;
 		}
-		if ((vm_flags & VM_UFFD_WP) && !(cur->vm_flags & VM_MAYWRITE))
-			goto out_unlock;
 
 		/*
 		 * Check that this vma isn't already owned by a
-- 
2.19.1

Powered by blists - more mailing lists