summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2025-09-20 03:01:22 +0300
committerJakub Kicinski <kuba@kernel.org>2025-09-20 03:01:22 +0300
commitd373176425ed0ddc8518e0a9cba27ecd07964bfd (patch)
tree567b7e24f5f5264e5f7f80e4888f0cf7b4ae60de /include
parentb02c1230104df86d282bd298e5313bb9686cbd70 (diff)
parent28bb24dadd0ed70aed43cf9af3a54c22c3ce04b2 (diff)
downloadlinux-d373176425ed0ddc8518e0a9cba27ecd07964bfd.tar.xz
Merge branch 'address-miscellaneous-issues-with-psp_sk_get_assoc_rcu'
Daniel Zahka says: ==================== address miscellaneous issues with psp_sk_get_assoc_rcu() There were a few minor issues with psp_sk_get_assoc_rcu() identified by Eric in his review of the initial psp series. This series addresses them. ==================== Link: https://patch.msgid.link/20250918155205.2197603-1-daniel.zahka@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/net/psp/functions.h13
1 files changed, 6 insertions, 7 deletions
diff --git a/include/net/psp/functions.h b/include/net/psp/functions.h
index 91ba06733321..ef7743664da3 100644
--- a/include/net/psp/functions.h
+++ b/include/net/psp/functions.h
@@ -124,19 +124,18 @@ psp_twsk_rx_policy_check(struct inet_timewait_sock *tw, struct sk_buff *skb)
return __psp_sk_rx_policy_check(skb, rcu_dereference(tw->psp_assoc));
}
-static inline struct psp_assoc *psp_sk_get_assoc_rcu(struct sock *sk)
+static inline struct psp_assoc *psp_sk_get_assoc_rcu(const struct sock *sk)
{
- struct inet_timewait_sock *tw;
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;
- tw = inet_twsk(sk);
- pas = state & TCPF_TIME_WAIT ? rcu_dereference(tw->psp_assoc) :
- rcu_dereference(sk->psp_assoc);
+ pas = state == TCP_TIME_WAIT ?
+ rcu_dereference(inet_twsk(sk)->psp_assoc) :
+ rcu_dereference(sk->psp_assoc);
return pas;
}