]> www.infradead.org Git - users/jedix/linux-maple.git/commit
rhashtable: Enforce minimum size on initial hash table
authorHerbert Xu <herbert@gondor.apana.org.au>
Wed, 16 Dec 2015 10:13:14 +0000 (18:13 +0800)
committerChuck Anderson <chuck.anderson@oracle.com>
Fri, 5 Feb 2016 03:33:30 +0000 (19:33 -0800)
commitdf2613affb993065d67eed9b1261fcfe0f8dbe1a
tree576022e9479530b7ac7578bd35ed66da6e22a8e7
parentde4ee52e2fd1f8c4c02a1bae012b51042a3e8e1b
rhashtable: Enforce minimum size on initial hash table

Orabug: 22623886

[ Upstream commit 3a324606bbabfc30084ce9d08169910773ba9a92 ]

William Hua <william.hua@canonical.com> wrote:
>
> I wasn't aware there was an enforced minimum size. I simply set the
> nelem_hint in the rhastable_params struct to 1, expecting it to grow as
> needed. This caused a segfault afterwards when trying to insert an
> element.

OK we're doing the size computation before we enforce the limit
on min_size.

---8<---
We need to do the initial hash table size computation after we
have obtained the correct min_size/max_size parameters.  Otherwise
we may end up with a hash table whose size is outside the allowed
envelope.

Fixes: a998f712f77e ("rhashtable: Round up/down min/max_size to...")
Reported-by: William Hua <william.hua@canonical.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 78e1970233fd270349834bb8b7ca84c58c7c974c)
Signed-off-by: Dan Duval <dan.duval@oracle.com>
lib/rhashtable.c