mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 23:32:14 +00:00
inet: limit length of fragment queue hash table bucket lists
This patch introduces a constant limit of the fragment queue hash table bucket list lengths. Currently the limit 128 is choosen somewhat arbitrary and just ensures that we can fill up the fragment cache with empty packets up to the default ip_frag_high_thresh limits. It should just protect from list iteration eating considerable amounts of cpu. If we reach the maximum length in one hash bucket a warning is printed. This is implemented on the caller side of inet_frag_find to distinguish between the different users of inet_fragment.c. I dropped the out of memory warning in the ipv4 fragment lookup path, because we already get a warning by the slab allocator. Cc: Eric Dumazet <eric.dumazet@gmail.com> Cc: Jesper Dangaard Brouer <jbrouer@redhat.com> Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
271648b4c6
commit
5a3da1fe95
5 changed files with 44 additions and 16 deletions
|
@ -26,6 +26,9 @@
|
|||
* YOSHIFUJI,H. @USAGI Always remove fragment header to
|
||||
* calculate ICV correctly.
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) "IPv6: " fmt
|
||||
|
||||
#include <linux/errno.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/string.h>
|
||||
|
@ -185,9 +188,10 @@ fq_find(struct net *net, __be32 id, const struct in6_addr *src, const struct in6
|
|||
hash = inet6_hash_frag(id, src, dst, ip6_frags.rnd);
|
||||
|
||||
q = inet_frag_find(&net->ipv6.frags, &ip6_frags, &arg, hash);
|
||||
if (q == NULL)
|
||||
if (IS_ERR_OR_NULL(q)) {
|
||||
inet_frag_maybe_warn_overflow(q, pr_fmt());
|
||||
return NULL;
|
||||
|
||||
}
|
||||
return container_of(q, struct frag_queue, q);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue