diff options
author | Herbert Xu | 2017-04-27 07:44:51 +0200 |
---|---|---|
committer | David S. Miller | 2017-04-27 17:48:24 +0200 |
commit | 6d684e54690caef45cf14051ddeb7c71beeb681b (patch) | |
tree | 1544faf80a19bf2fa47d9f2a1e5f2f98dbb17545 /samples/bpf/test_cgrp2_attach2.c | |
parent | tcp: tcp_rack_reo_timeout() must update tp->tcp_mstamp (diff) | |
download | kernel-qcow2-linux-6d684e54690caef45cf14051ddeb7c71beeb681b.tar.gz kernel-qcow2-linux-6d684e54690caef45cf14051ddeb7c71beeb681b.tar.xz kernel-qcow2-linux-6d684e54690caef45cf14051ddeb7c71beeb681b.zip |
rhashtable: Cap total number of entries to 2^31
When max_size is not set or if it set to a sufficiently large
value, the nelems counter can overflow. This would cause havoc
with the automatic shrinking as it would then attempt to fit a
huge number of entries into a tiny hash table.
This patch fixes this by adding max_elems to struct rhashtable
to cap the number of elements. This is set to 2^31 as nelems is
not a precise count. This is sufficiently smaller than UINT_MAX
that it should be safe.
When max_size is set max_elems will be lowered to at most twice
max_size as is the status quo.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'samples/bpf/test_cgrp2_attach2.c')
0 files changed, 0 insertions, 0 deletions