On 6/16/25 19:21, Stanislav Fomichev wrote: > udp_tunnel_push_rx_port will grab mutex in the next patch so > we can't use rcu. geneve_offload_rx_ports is called > from geneve_netdevice_event for NETDEV_UDP_TUNNEL_PUSH_INFO and > NETDEV_UDP_TUNNEL_DROP_INFO which both have ASSERT_RTNL. > Entries are added to and removed from the sock_list under rtnl > lock as well (when adding or removing a tunneling device). > > Signed-off-by: Stanislav Fomichev <[email protected]> > --- > drivers/net/geneve.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c > index ffc15a432689..9efedc6758bf 100644 > --- a/drivers/net/geneve.c > +++ b/drivers/net/geneve.c > @@ -41,6 +41,7 @@ MODULE_PARM_DESC(log_ecn_error, "Log packets received with > corrupted ECN"); > /* per-network namespace private data for this module */ > struct geneve_net { > struct list_head geneve_list; > + /* sock_list is protected by rtnl lock */ > struct list_head sock_list; > }; > > @@ -1179,8 +1180,9 @@ static void geneve_offload_rx_ports(struct net_device > *dev, bool push) > struct geneve_net *gn = net_generic(net, geneve_net_id); > struct geneve_sock *gs; > > - rcu_read_lock(); > - list_for_each_entry_rcu(gs, &gn->sock_list, list) { > + ASSERT_RTNL(); > + > + list_for_each_entry(gs, &gn->sock_list, list) { > if (push) { > udp_tunnel_push_rx_port(dev, gs->sock, > UDP_TUNNEL_TYPE_GENEVE); > @@ -1189,7 +1191,6 @@ static void geneve_offload_rx_ports(struct net_device > *dev, bool push) > UDP_TUNNEL_TYPE_GENEVE); > } > } > - rcu_read_unlock(); > } > > /* Initialize the device structure. */
Reviewed-by: Nikolay Aleksandrov <[email protected]>

