[<prev] [next>] [day] [month] [year] [list]
Message-ID: <17f0f145b89c8447fd3b8a988f26bec41a503b7f.1768811736.git.antony.antony@secunet.com>
Date: Mon, 19 Jan 2026 09:53:46 +0100
From: Antony Antony <antony.antony@...unet.com>
To: Antony Antony <antony.antony@...unet.com>, Steffen Klassert
<steffen.klassert@...unet.com>, Herbert Xu <herbert@...dor.apana.org.au>,
<netdev@...r.kernel.org>
CC: "David S . Miller" <davem@...emloft.net>, Eric Dumazet
<edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni
<pabeni@...hat.com>, Chiachang Wang <chiachangwang@...gle.com>, Yan Yan
<evitayan@...gle.com>, <devel@...ux-ipsec.org>, Simon Horman
<horms@...nel.org>, <linux-kernel@...r.kernel.org>
Subject: [PATCH ipsec-next v4 1/5] xfrm: add missing __rcu annotation to nlsk
The nlsk field in struct netns_xfrm is RCU-protected, as seen by
the use of rcu_assign_pointer() and RCU_INIT_POINTER() when updating
it.
However, the field lacks the __rcu annotation, and most read-side
accesses don't use rcu_dereference().
Add the missing __rcu annotation and convert all read-side accesses to
use rcu_dereference() for correctness and to silence sparse warnings.
Sparse warning reported by NIPA allmodconfig test when modifying
net/xfrm/xfrm_user.c. The warning is a pre-existing issue in
xfrm_nlmsg_multicast(). This series added a new call to this function
and NIPA testing reported a new warning was added by this series.
To reproduce (requires sparse):
make C=2 net/xfrm/
net/xfrm/xfrm_user.c:1574:29: error: incompatible types in comparison
expression (different address spaces):
net/xfrm/xfrm_user.c:1574:29: struct sock [noderef] __rcu *
net/xfrm/xfrm_user.c:1574:29: struct sock *
Signed-off-by: Antony Antony <antony.antony@...unet.com>
---
include/net/netns/xfrm.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/net/netns/xfrm.h b/include/net/netns/xfrm.h
index 23dd647fe024..ed8eee81bbb0 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;
--
2.39.5
Powered by blists - more mailing lists