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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250210100948.312130-1-richard120310@gmail.com>
Date: Mon, 10 Feb 2025 18:09:48 +0800
From: I Hsin Cheng <richard120310@...il.com>
To: akpm@...ux-foundation.org
Cc: zhengqi.arch@...edance.com,
	linux-mm@...ck.org,
	linux-kernel@...r.kernel.org,
	jserv@...s.ncku.edu.tw,
	I Hsin Cheng <richard120310@...il.com>
Subject: [PATCH] mm: pgtable: Unlock pml without branches when !start_pte

When !start_pte is true, the branch for "start_pte" in "out_ptl" label
section is surely false, and "ptl != pml" must be true since "ptl" is
NULL in this case.

It means both branches in "out_ptl" are redundant, only one thing to be
done is to unlock "pml", make it directly unlock "pml" and return in
this case.

Signed-off-by: I Hsin Cheng <richard120310@...il.com>
---
 mm/pt_reclaim.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/mm/pt_reclaim.c b/mm/pt_reclaim.c
index 7e9455a18aae..f5d5c42a4679 100644
--- a/mm/pt_reclaim.c
+++ b/mm/pt_reclaim.c
@@ -42,8 +42,10 @@ void try_to_free_pte(struct mm_struct *mm, pmd_t *pmd, unsigned long addr,
 
 	pml = pmd_lock(mm, pmd);
 	start_pte = pte_offset_map_rw_nolock(mm, pmd, addr, &pmdval, &ptl);
-	if (!start_pte)
-		goto out_ptl;
+	if (!start_pte) {
+		spin_unlock(pml);
+		return;
+	}
 	if (ptl != pml)
 		spin_lock_nested(ptl, SINGLE_DEPTH_NESTING);
 
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ