diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 185ed3e598027a475b6ed62c4a0e9f9838793f4d..d92f94b7e4025dd4779e75e6a75f2de560713778 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -1861,6 +1861,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;