Skip to content

Commit 179ccc0

Browse files
herbertxdavem330
authored andcommitted
rhashtable: Kill harmless RCU warning in rhashtable_walk_init
The commit c6ff526 ("rhashtable: Fix walker list corruption") causes a suspicious RCU usage warning because we no longer hold ht->mutex when we dereference ht->tbl. However, this is a false positive because we now hold ht->lock which also guarantees that ht->tbl won't disppear from under us. This patch kills the warning by using rcu_dereference_protected. Reported-by: kernel test robot <[email protected]> Signed-off-by: Herbert Xu <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent e905eab commit 179ccc0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/rhashtable.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,8 @@ int rhashtable_walk_init(struct rhashtable *ht, struct rhashtable_iter *iter)
519519
return -ENOMEM;
520520

521521
spin_lock(&ht->lock);
522-
iter->walker->tbl = rht_dereference(ht->tbl, ht);
522+
iter->walker->tbl =
523+
rcu_dereference_protected(ht->tbl, lockdep_is_held(&ht->lock));
523524
list_add(&iter->walker->list, &iter->walker->tbl->walkers);
524525
spin_unlock(&ht->lock);
525526

0 commit comments

Comments
 (0)