Skip to contentSkip to conversation

batman-adv: make mc_forwarding atomic

PATCH New Sven Eckelmann 1 participant 1 message Mar 2, 2022 Batman advanced

lore
Share & tools
lore

Sven Eckelmann

author maintainer
#0 lore raw

PATCH 1/1 batman-adv: make mc_forwarding atomic

From: Eric Dumazet <[email protected]>

This fixes minor data-races in ip6_mc_input() and
batadv_mcast_mla_rtr_flags_softif_get_ipv6()

[[email protected]: Add ugly hack to get it building with old kernels]

---
net-next commit 145c7a793838 ("ipv6: make mc_forwarding atomic")

I didn't find a good way to handle this. So either we introduce the auto-patch-before build stuff again or we allow minimal changes like this which are not in sync with upstream.

I will try to have a look at ways how we can (with our build_tests):

* filter out everything with UGLY_HACK + everything between UGLY_HACK_OLD + UGLY_HACK_STOP before comparing it with upstream
* have some automatic warning in case someone adds code to linux-merge.git with UGLY_HACK in it

 net/batman-adv/multicast.c | 4 ++++
 1 file changed, 4 insertions(+)
net/batman-adv/multicast.c +4 -0
index 1860de73..720c12c0 100644
@@ -135,7 +135,11 @@ static u8 batadv_mcast_mla_rtr_flags_softif_get_ipv6(struct net_device *dev)
 {
 	struct inet6_dev *in6_dev = __in6_dev_get(dev);
 
+#if LINUX_VERSION_IS_GEQ(5, 18, 0) // UGLY_HACK_NEW
+	if (in6_dev && atomic_read(&in6_dev->cnf.mc_forwarding))
+#else // UGLY_HACK_OLD
 	if (in6_dev && in6_dev->cnf.mc_forwarding)
+#endif // UGLY_HACK_STOP
 		return BATADV_NO_FLAGS;
 	else
 		return BATADV_MCAST_WANT_NO_RTR6;
Signature · 1 line
2.30.2