Thread (2 messages) 2 messages, 2 authors, 16h ago
HOTtoday

[PATCH net] net: dst: block BH in ipip6_tunnel_xmit

From: yuan.gao <hidden>
Date: 2026-06-22 03:31:33
Also in: lkml
Subsystem: networking [general], the rest · Maintainers: "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

Similar to commit 1378817486d6 ("tipc: block BH before using dst_cache"),
the dst cache helper functions must be invoked with local BH disabled.

This ensures proper synchronization and fixes a potential race condition
on SMP systems.

Signed-off-by: yuan.gao <redacted>
---
 net/ipv6/sit.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 201347b4e1274..2a63b346634e7 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -934,14 +934,20 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb,
 			   IPPROTO_IPV6, 0, dst, tiph->saddr, 0, 0,
 			   sock_net_uid(tunnel->net, NULL));
 
+	local_bh_disable();
 	rt = dst_cache_get_ip4(&tunnel->dst_cache, &fl4.saddr);
+	local_bh_enable();
+
 	if (!rt) {
 		rt = ip_route_output_flow(tunnel->net, &fl4, NULL);
 		if (IS_ERR(rt)) {
 			DEV_STATS_INC(dev, tx_carrier_errors);
 			goto tx_error_icmp;
 		}
+
+		local_bh_disable();
 		dst_cache_set_ip4(&tunnel->dst_cache, &rt->dst, fl4.saddr);
+		local_bh_enable();
 	}
 
 	if (rt->rt_type != RTN_UNICAST && rt->rt_type != RTN_LOCAL) {
-- 
2.32.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help