rhashtable: Fix use-after-free in rhashtable_walk_stop
[deliverable/linux.git] / lib / rhashtable.c
index 9d53a46dcca9c14f5394a7b088a290a3e5ae0b2e..b916679b3e3b74a54e3e5b33a2a853f6a72e9605 100644 (file)
@@ -854,10 +854,8 @@ void rhashtable_walk_stop(struct rhashtable_iter *iter)
        struct rhashtable *ht;
        struct bucket_table *tbl = iter->walker->tbl;
 
-       rcu_read_unlock();
-
        if (!tbl)
-               return;
+               goto out;
 
        ht = iter->ht;
 
@@ -869,6 +867,9 @@ void rhashtable_walk_stop(struct rhashtable_iter *iter)
        mutex_unlock(&ht->mutex);
 
        iter->p = NULL;
+
+out:
+       rcu_read_unlock();
 }
 EXPORT_SYMBOL_GPL(rhashtable_walk_stop);
 
This page took 0.040508 seconds and 5 git commands to generate.