Skip to content

Commit

Permalink
rhashtable: Fix read-side crash during rehash
Browse files Browse the repository at this point in the history
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: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Herbert Xu authored and David S. Miller committed Mar 13, 2015
1 parent a5b6846 commit 3936194
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rhashtable.c
Original file line number Diff line number Diff line change
Expand Up @@ -606,8 +606,8 @@ void *rhashtable_lookup_compare(struct rhashtable *ht, const void *key,
rcu_read_lock();

tbl = rht_dereference_rcu(ht->tbl, ht);
hash = key_hashfn(ht, tbl, key);
restart:
hash = key_hashfn(ht, tbl, key);
rht_for_each_rcu(he, tbl, hash) {
if (!compare(rht_obj(ht, he), arg))
continue;
Expand Down

0 comments on commit 3936194

Please sign in to comment.