summaryrefslogtreecommitdiff
path: root/include/net
diff options
context:
space:
mode:
authorSabrina Dubroca <sd@queasysnail.net>2026-03-09 11:32:43 +0100
committerSteffen Klassert <steffen.klassert@secunet.com>2026-03-12 07:16:02 +0100
commitd87f8bc47fbf012a7f115e311d0603d97e47c34c (patch)
tree01835b29c26fd103afa0259a0b8982aceabd1951 /include/net
parent103b4f5b4007cb484f40b1c8095a7e0526e5aff6 (diff)
xfrm: avoid RCU warnings around the per-netns netlink socket
net->xfrm.nlsk is used in 2 types of contexts: - fully under RCU, with rcu_read_lock + rcu_dereference and a NULL check - in the netlink handlers, with requests coming from a userspace socket In the 2nd case, net->xfrm.nlsk is guaranteed to stay non-NULL and the object is alive, since we can't enter the netns destruction path while the user socket holds a reference on the netns. After adding the __rcu annotation to netns_xfrm.nlsk (which silences sparse warnings in the RCU users and __net_init code), we need to tell sparse that the 2nd case is safe. Add a helper for that. Signed-off-by: Sabrina Dubroca <sd@queasysnail.net> Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/netns/xfrm.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/net/netns/xfrm.h b/include/net/netns/xfrm.h
index 23dd647fe024..b73983a17e08 100644
--- a/include/net/netns/xfrm.h
+++ b/include/net/netns/xfrm.h
@@ -59,7 +59,7 @@ struct netns_xfrm {
struct list_head inexact_bins;
- struct sock *nlsk;
+ struct sock __rcu *nlsk;
struct sock *nlsk_stash;
u32 sysctl_aevent_etime;