Skip to contentSkip to conversation

Followup needed for netfilter: nft_fib_ipv6: walk fib6_siblings under RCU?

PATCH Florian Westphal 2 participants 2 messages May 25 – May 26

Subsystems (2)
lore
Share & tools
lore

Florian Westphal

author maintainer
#0 lore raw

Hello,

Sashiko claims we need this change:

net/ipv6/netfilter/nft_fib_ipv6.c +3 -0
@@ -191,6 +191,9 @@ static bool nft_fib6_info_nh_uses_dev(struct fib6_info *rt,
 
                if (nft_fib6_info_nh_dev_match(nh_dev, dev))
                        return true;
+
+               if (!READ_ONCE(rt->fib6_nsiblings))
+                       return false;
        }
 
        return false;

Could ypu please check and send a followup if its correct? AFAICS the nodes can be relinked to a *different* list and then this turns into busyloop without the extra test.

https://sashiko.dev/#/patchset/20260520023411.391233-1-jiayuan.chen%40linux.dev

Thank you.

#1 lore raw
Quoted 19 lines · Florian Westphal

Hello,

Sashiko claims we need this change:

net/ipv6/netfilter/nft_fib_ipv6.c +3 -0
@@ -191,6 +191,9 @@ static bool nft_fib6_info_nh_uses_dev(struct fib6_info *rt,
 
                 if (nft_fib6_info_nh_dev_match(nh_dev, dev))
                         return true;
+
+               if (!READ_ONCE(rt->fib6_nsiblings))
+                       return false;
         }
 
         return false;
Quoted 7 lines

Could ypu please check and send a followup if its correct? AFAICS the nodes can be relinked to a*different* list and then this turns into busyloop without the extra test.

https://sashiko.dev/#/patchset/20260520023411.391233-1-jiayuan.chen%40linux.dev

Thank you.

Hi,

Thanks, you're right. net/ipv6/route.c already uses the same pattern, and Eric applied similar fixes:

f8d8ce1b515a ("ipv6: fix possible infinite loop in fib6_info_uses_dev()") 54e6fe9dd3b0 ("ipv6: prevent infinite loop in rt6_nlmsg_size()")

I'll send a follow-up patch.

Thanks,
Jiayuan