From b5e8eadb1c8a800b1fe7bec42b5e0c696f69e1aa Mon Sep 17 00:00:00 2001 From: Eric Dumazet Date: Mon, 7 Sep 2026 07:58:41 +0000 Subject: [PATCH] sit: annotate data-races around tunnel->fwmark ipip6_tunnel_xmit() runs locklessly (dev->lltx == true) and reads tunnel->fwmark. In preparation for converting ipip6_fill_info() to run without RTNL, add READ_ONCE() and WRITE_ONCE() annotations around tunnel->fwmark. Signed-off-by: Eric Dumazet Acked-by: Lorenzo Bianconi Link: https://patch.msgid.link/20260907075846.2913645-5-edumazet@google.com Signed-off-by: Jakub Kicinski --- net/ipv6/sit.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c index 9a2bbd76d379..e85fa80e80d1 100644 --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c @@ -929,7 +929,7 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb, if (!dst && !ipip6_tunnel_dst_find(skb, &dst, false)) goto tx_error; - flowi4_init_output(&fl4, tunnel->parms.link, tunnel->fwmark, + flowi4_init_output(&fl4, tunnel->parms.link, READ_ONCE(tunnel->fwmark), tos & INET_DSCP_MASK, RT_SCOPE_UNIVERSE, IPPROTO_IPV6, 0, dst, tiph->saddr, 0, 0, sock_net_uid(tunnel->net, NULL)); @@ -1153,7 +1153,7 @@ static void ipip6_tunnel_update(struct ip_tunnel *t, t->parms.iph.frag_off = p->iph.frag_off; if (t->parms.link != p->link || t->fwmark != fwmark) { t->parms.link = p->link; - t->fwmark = fwmark; + WRITE_ONCE(t->fwmark, fwmark); ipip6_tunnel_bind_dev(t->dev); } dst_cache_reset(&t->dst_cache); @@ -1706,7 +1706,7 @@ static int ipip6_fill_info(struct sk_buff *skb, const struct net_device *dev) nla_put_u8(skb, IFLA_IPTUN_PROTO, parm->iph.protocol) || nla_put_be16(skb, IFLA_IPTUN_FLAGS, ip_tunnel_flags_to_be16(parm->i_flags)) || - nla_put_u32(skb, IFLA_IPTUN_FWMARK, tunnel->fwmark)) + nla_put_u32(skb, IFLA_IPTUN_FWMARK, READ_ONCE(tunnel->fwmark))) goto nla_put_failure; #ifdef CONFIG_IPV6_SIT_6RD