Skip to content

Commit 3e14960

Browse files
Stanislav Fomichevkuba-moo
authored andcommitted
geneve: rely on rtnl lock in geneve_offload_rx_ports
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]> Reviewed-by: Nikolay Aleksandrov <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent a335569 commit 3e14960

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/net/geneve.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ MODULE_PARM_DESC(log_ecn_error, "Log packets received with corrupted ECN");
4141
/* per-network namespace private data for this module */
4242
struct geneve_net {
4343
struct list_head geneve_list;
44+
/* sock_list is protected by rtnl lock */
4445
struct list_head sock_list;
4546
};
4647

@@ -1180,8 +1181,9 @@ static void geneve_offload_rx_ports(struct net_device *dev, bool push)
11801181
struct geneve_net *gn = net_generic(net, geneve_net_id);
11811182
struct geneve_sock *gs;
11821183

1183-
rcu_read_lock();
1184-
list_for_each_entry_rcu(gs, &gn->sock_list, list) {
1184+
ASSERT_RTNL();
1185+
1186+
list_for_each_entry(gs, &gn->sock_list, list) {
11851187
if (push) {
11861188
udp_tunnel_push_rx_port(dev, gs->sock,
11871189
UDP_TUNNEL_TYPE_GENEVE);
@@ -1190,7 +1192,6 @@ static void geneve_offload_rx_ports(struct net_device *dev, bool push)
11901192
UDP_TUNNEL_TYPE_GENEVE);
11911193
}
11921194
}
1193-
rcu_read_unlock();
11941195
}
11951196

11961197
/* Initialize the device structure. */

0 commit comments

Comments
 (0)