On Thu, Sep 3, 2026 at 5:08 AM Eric Dumazet [off-list ref] wrote:
vxlan_vnifilter_dump_dev() runs under rcu_read_lock() without RTNL when
dumping VNI filter entries via RTM_GETTUNNEL.
1) Currently it traverses vg->vni_list using list_for_each_entry_safe(),
which performs raw pointer accesses without RCU dereference barriers.
Since concurrent RTNL writers modify vg->vni_list using list_add_rcu()
and list_del_rcu(), use list_for_each_entry_rcu() instead.
2) If vxlan_vnifilter_dump_dev() returns early because VXLAN_F_VNIFILTER
is not set or vg has no VNIs, cb->args[1] was not cleared. If a
paginated dump was in progress, this leaked a non-zero cb->args[1]
to the next device in vxlan_vnifilter_dump(), silently skipping its
first N VNIs. Clear cb->args[1] on early returns.
Fixes: f9c4bb0b245c ("vxlan: vni filtering support on collect metadata device")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>