summaryrefslogtreecommitdiff
path: root/net/bridge/br_multicast_eht.c
diff options
context:
space:
mode:
authorNikolay Aleksandrov <nikolay@nvidia.com>2021-01-26 12:35:32 +0300
committerJakub Kicinski <kuba@kernel.org>2021-01-28 04:40:35 +0300
commit89268b056ed116e13ba39f46481ad8bf5eef7bc4 (patch)
tree257ab964c03ca0136ac4ebddf7bc78f327a36e30 /net/bridge/br_multicast_eht.c
parent1d96006dccf0994dd91f327f59493afd6398b01d (diff)
downloadlinux-89268b056ed116e13ba39f46481ad8bf5eef7bc4.tar.xz
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 <nikolay@nvidia.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/bridge/br_multicast_eht.c')
-rw-r--r--net/bridge/br_multicast_eht.c7
1 files changed, 7 insertions, 0 deletions
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;
}