summaryrefslogtreecommitdiff
path: root/include/net/psp/functions.h
diff options
context:
space:
mode:
authorDaniel Zahka <daniel.zahka@gmail.com>2025-09-18 08:52:03 -0700
committerJakub Kicinski <kuba@kernel.org>2025-09-19 17:01:20 -0700
commit803cdb6ddca3e24418226e17e4b1c1134619aca8 (patch)
tree4c8c2a64e30db32411d06695b9a68a9ca36ba6be /include/net/psp/functions.h
parentf8d2f8205be8cceef2dd3c0e68e7af3c5f83c75c (diff)
psp: fix preemptive inet_twsk() cast in psp_sk_get_assoc_rcu()
It is weird to cast to a timewait_sock before checking sk_state, even if the use is after such a check. Remove the tw local variable, and use inet_twsk() directly in the timewait branch. Signed-off-by: Daniel Zahka <daniel.zahka@gmail.com> Link: https://patch.msgid.link/20250918155205.2197603-3-daniel.zahka@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include/net/psp/functions.h')
-rw-r--r--include/net/psp/functions.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/include/net/psp/functions.h b/include/net/psp/functions.h
index fb3cbe8427ea..980de7e58f8a 100644
--- a/include/net/psp/functions.h
+++ b/include/net/psp/functions.h
@@ -126,7 +126,6 @@ psp_twsk_rx_policy_check(struct inet_timewait_sock *tw, struct sk_buff *skb)
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;
@@ -134,9 +133,9 @@ static inline struct psp_assoc *psp_sk_get_assoc_rcu(const struct sock *sk)
if (!sk_is_inet(sk) || state & TCPF_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 & TCPF_TIME_WAIT ?
+ rcu_dereference(inet_twsk(sk)->psp_assoc) :
+ rcu_dereference(sk->psp_assoc);
return pas;
}