Commit 39361947 authored by Herbert Xu's avatar Herbert Xu Committed by David S. Miller

rhashtable: Fix read-side crash during rehash

This patch fixes a typo rhashtable_lookup_compare where we fail
to recompute the hash when looking up the new table.  This causes
elements to be missed and potentially a crash during a resize.
Reported-by: default avatarThomas Graf <tgraf@suug.ch>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a5b6846f
...@@ -606,8 +606,8 @@ void *rhashtable_lookup_compare(struct rhashtable *ht, const void *key, ...@@ -606,8 +606,8 @@ void *rhashtable_lookup_compare(struct rhashtable *ht, const void *key,
rcu_read_lock(); rcu_read_lock();
tbl = rht_dereference_rcu(ht->tbl, ht); tbl = rht_dereference_rcu(ht->tbl, ht);
hash = key_hashfn(ht, tbl, key);
restart: restart:
hash = key_hashfn(ht, tbl, key);
rht_for_each_rcu(he, tbl, hash) { rht_for_each_rcu(he, tbl, hash) {
if (!compare(rht_obj(ht, he), arg)) if (!compare(rht_obj(ht, he), arg))
continue; continue;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment