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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250918155205.2197603-4-daniel.zahka@gmail.com>
Date: Thu, 18 Sep 2025 08:52:04 -0700
From: Daniel Zahka <daniel.zahka@...il.com>
To: "David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>,
	Paolo Abeni <pabeni@...hat.com>,
	Simon Horman <horms@...nel.org>
Cc: Willem de Bruijn <willemb@...gle.com>,
	netdev@...r.kernel.org
Subject: [PATCH net-next 3/3] psp: don't use flags for checking sk_state

Using flags to check sk_state only makes sense to check for a subset
of states in parallel e.g. sk_fullsock(). We are not doing that
here. Compare for individual states directly.

Signed-off-by: Daniel Zahka <daniel.zahka@...il.com>
---
 include/net/psp/functions.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/net/psp/functions.h b/include/net/psp/functions.h
index 980de7e58f8a..ef7743664da3 100644
--- a/include/net/psp/functions.h
+++ b/include/net/psp/functions.h
@@ -129,11 +129,11 @@ static inline struct psp_assoc *psp_sk_get_assoc_rcu(const struct sock *sk)
 	struct psp_assoc *pas;
 	int state;
 
-	state = 1 << READ_ONCE(sk->sk_state);
-	if (!sk_is_inet(sk) || state & TCPF_NEW_SYN_RECV)
+	state = READ_ONCE(sk->sk_state);
+	if (!sk_is_inet(sk) || state == TCP_NEW_SYN_RECV)
 		return NULL;
 
-	pas = state & TCPF_TIME_WAIT ?
+	pas = state == TCP_TIME_WAIT ?
 		      rcu_dereference(inet_twsk(sk)->psp_assoc) :
 		      rcu_dereference(sk->psp_assoc);
 	return pas;
-- 
2.47.3


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ