rhashtable: fix rht_for_each_entry_safe() endless loop
[linux-2.6-block.git] / include / linux / rhashtable.h
index a2562ed53ea3eed8b7632a72f41872b30336aae1..e0337844358e164e189b58ae90c530f71963b6bf 100644 (file)
@@ -260,7 +260,9 @@ void rhashtable_destroy(struct rhashtable *ht);
             next = !rht_is_a_nulls(pos) ?                                  \
                       rht_dereference_bucket(pos->next, tbl, hash) : NULL; \
             (!rht_is_a_nulls(pos)) && rht_entry(tpos, pos, member);        \
-            pos = next)
+            pos = next,                                                    \
+            next = !rht_is_a_nulls(pos) ?                                  \
+                      rht_dereference_bucket(pos->next, tbl, hash) : NULL)
 
 /**
  * rht_for_each_rcu_continue - continue iterating over rcu hash chain