summaryrefslogtreecommitdiffstats
path: root/lib/rhashtable.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2017-02-25 15:39:50 +0100
committerDavid S. Miller <davem@davemloft.net>2017-02-27 03:33:43 +0100
commitc4d2603dac3a555e4bb324daf5cb5cdb5694eedd (patch)
treeaa471c625bdf28475ad8d5b6c48520ef547dac7d /lib/rhashtable.c
parentrhashtable: Fix use before NULL check in bucket_table_free (diff)
downloadlinux-c4d2603dac3a555e4bb324daf5cb5cdb5694eedd.tar.xz
linux-c4d2603dac3a555e4bb324daf5cb5cdb5694eedd.zip
rhashtable: Fix RCU dereference annotation in rht_bucket_nested
The current annotation is wrong as it says that we're only called under spinlock. In fact it should be marked as under either spinlock or RCU read lock. Fixes: da20420f83ea ("rhashtable: Add nested tables") Reported-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'lib/rhashtable.c')
-rw-r--r--lib/rhashtable.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/rhashtable.c b/lib/rhashtable.c
index fac1a78afb39..c5b9b9351cec 100644
--- a/lib/rhashtable.c
+++ b/lib/rhashtable.c
@@ -1121,12 +1121,13 @@ struct rhash_head __rcu **rht_bucket_nested(const struct bucket_table *tbl,
union nested_table *ntbl;
ntbl = (union nested_table *)rcu_dereference_raw(tbl->buckets[0]);
- ntbl = rht_dereference_bucket(ntbl[index].table, tbl, hash);
+ ntbl = rht_dereference_bucket_rcu(ntbl[index].table, tbl, hash);
subhash >>= tbl->nest;
while (ntbl && size > (1 << shift)) {
index = subhash & ((1 << shift) - 1);
- ntbl = rht_dereference_bucket(ntbl[index].table, tbl, hash);
+ ntbl = rht_dereference_bucket_rcu(ntbl[index].table,
+ tbl, hash);
size >>= shift;
subhash >>= shift;
}