From 89268b056ed116e13ba39f46481ad8bf5eef7bc4 Mon Sep 17 00:00:00 2001 From: Nikolay Aleksandrov Date: Tue, 26 Jan 2021 11:35:32 +0200 Subject: net: bridge: multicast: add per-port EHT hosts limit Add a default limit of 512 for number of tracked EHT hosts per-port. Signed-off-by: Nikolay Aleksandrov Signed-off-by: Jakub Kicinski --- net/bridge/br_multicast_eht.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'net/bridge/br_multicast_eht.c') diff --git a/net/bridge/br_multicast_eht.c b/net/bridge/br_multicast_eht.c index ff9b3ba37cab..445768c8495f 100644 --- a/net/bridge/br_multicast_eht.c +++ b/net/bridge/br_multicast_eht.c @@ -127,6 +127,8 @@ static void __eht_destroy_host(struct net_bridge_group_eht_host *eht_host) { WARN_ON(!hlist_empty(&eht_host->set_entries)); + br_multicast_eht_hosts_dec(eht_host->pg); + rb_erase(&eht_host->rb_node, &eht_host->pg->eht_host_tree); RB_CLEAR_NODE(&eht_host->rb_node); kfree(eht_host); @@ -257,6 +259,9 @@ __eht_lookup_create_host(struct net_bridge_port_group *pg, return this; } + if (br_multicast_eht_hosts_over_limit(pg)) + return NULL; + eht_host = kzalloc(sizeof(*eht_host), GFP_ATOMIC); if (!eht_host) return NULL; @@ -269,6 +274,8 @@ __eht_lookup_create_host(struct net_bridge_port_group *pg, rb_link_node(&eht_host->rb_node, parent, link); rb_insert_color(&eht_host->rb_node, &pg->eht_host_tree); + br_multicast_eht_hosts_inc(pg); + return eht_host; } -- cgit v1.2.3