Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c88455ce authored by Thomas Graf's avatar Thomas Graf Committed by David S. Miller
Browse files

rhashtable: key_hashfn() must return full hash value



The value computed by key_hashfn() is used by rhashtable_lookup_compare()
to traverse both tables during a resize. key_hashfn() must therefore
return the hash value without the buckets mask applied so it can be
masked to the size of each individual table.

Fixes: 97defe1e ("rhashtable: Per bucket locks & deferred expansion/shrinking")
Signed-off-by: default avatarThomas Graf <tgraf@suug.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2ca292d9
Loading
Loading
Loading
Loading
+1 −7
Original line number Original line Diff line number Diff line
@@ -94,13 +94,7 @@ static u32 obj_raw_hashfn(const struct rhashtable *ht, const void *ptr)


static u32 key_hashfn(struct rhashtable *ht, const void *key, u32 len)
static u32 key_hashfn(struct rhashtable *ht, const void *key, u32 len)
{
{
	struct bucket_table *tbl = rht_dereference_rcu(ht->tbl, ht);
	return ht->p.hashfn(key, len, ht->p.hash_rnd) >> HASH_RESERVED_SPACE;
	u32 hash;

	hash = ht->p.hashfn(key, len, ht->p.hash_rnd);
	hash >>= HASH_RESERVED_SPACE;

	return rht_bucket_index(tbl, hash);
}
}


static u32 head_hashfn(const struct rhashtable *ht,
static u32 head_hashfn(const struct rhashtable *ht,