diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index db06b846cac4..509b18b2b24d 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -1828,6 +1828,10 @@ static struct sock *__udp4_lib_mcast_demux_lookup(struct net *net, unsigned int count, slot = udp_hashfn(net, hnum, udp_table.mask); struct udp_hslot *hslot = &udp_table.hash[slot]; + /* Do not bother scanning a too big list */ + if (hslot->count > 10) + return NULL; + rcu_read_lock(); begin: count = 0;