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>] [day] [month] [year] [list]
Message-Id: <20250817135626.162124-1-rongqianfeng@vivo.com>
Date: Sun, 17 Aug 2025 21:56:26 +0800
From: Qianfeng Rong <rongqianfeng@...o.com>
To: Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	Peter Zijlstra <peterz@...radead.org>,
	Darren Hart <dvhart@...radead.org>,
	Davidlohr Bueso <dave@...olabs.net>,
	André Almeida <andrealmeid@...lia.com>,
	linux-kernel@...r.kernel.org
Cc: Qianfeng Rong <rongqianfeng@...o.com>
Subject: [PATCH] futex: Remove redundant null checks for kvfree()

Remove temporary variable and conditional check in futex_hash_free(),
directly freeing mm->futex_phash with kvfree() which safely handles
NULL pointers.

Signed-off-by: Qianfeng Rong <rongqianfeng@...o.com>
---
 kernel/futex/core.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/kernel/futex/core.c b/kernel/futex/core.c
index d9bb5567af0c..ea96795aa4a7 100644
--- a/kernel/futex/core.c
+++ b/kernel/futex/core.c
@@ -1733,13 +1733,9 @@ int futex_mm_init(struct mm_struct *mm)
 
 void futex_hash_free(struct mm_struct *mm)
 {
-	struct futex_private_hash *fph;
-
 	free_percpu(mm->futex_ref);
 	kvfree(mm->futex_phash_new);
-	fph = rcu_dereference_raw(mm->futex_phash);
-	if (fph)
-		kvfree(fph);
+	kvfree(rcu_dereference_raw(mm->futex_phash));
 }
 
 static bool futex_pivot_pending(struct mm_struct *mm)
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ