All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rhashtable: fix rht_for_each_entry_safe() endless loop
@ 2015-01-21 11:12 Patrick McHardy
  2015-01-21 11:43 ` Thomas Graf
  2015-01-26  8:08 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Patrick McHardy @ 2015-01-21 11:12 UTC (permalink / raw)
  To: tgraf; +Cc: davem, netdev, Patrick McHardy

"next" is not updated, causing an endless loop for buckets with more than
one element.

Signed-off-by: Patrick McHardy <kaber@trash.net>
---
 include/linux/rhashtable.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h
index 9570832..83944f9 100644
--- a/include/linux/rhashtable.h
+++ b/include/linux/rhashtable.h
@@ -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
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] rhashtable: fix rht_for_each_entry_safe() endless loop
  2015-01-21 11:12 [PATCH] rhashtable: fix rht_for_each_entry_safe() endless loop Patrick McHardy
@ 2015-01-21 11:43 ` Thomas Graf
  2015-01-26  8:08 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Graf @ 2015-01-21 11:43 UTC (permalink / raw)
  To: Patrick McHardy; +Cc: davem, netdev

On 01/21/15 at 11:12am, Patrick McHardy wrote:
> "next" is not updated, causing an endless loop for buckets with more than
> one element.
> 
> Signed-off-by: Patrick McHardy <kaber@trash.net>

Fixes: 88d6ed15acff ("rhashtable: Convert bucket iterators to take table and index")

Acked-by: Thomas Graf <tgraf@suug.ch>

Dave: This only affects net-next.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] rhashtable: fix rht_for_each_entry_safe() endless loop
  2015-01-21 11:12 [PATCH] rhashtable: fix rht_for_each_entry_safe() endless loop Patrick McHardy
  2015-01-21 11:43 ` Thomas Graf
@ 2015-01-26  8:08 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2015-01-26  8:08 UTC (permalink / raw)
  To: kaber; +Cc: tgraf, netdev

From: Patrick McHardy <kaber@trash.net>
Date: Wed, 21 Jan 2015 11:12:13 +0000

> "next" is not updated, causing an endless loop for buckets with more than
> one element.
> 
> Signed-off-by: Patrick McHardy <kaber@trash.net>

Applied, thanks Patrick.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-01-26  8:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-21 11:12 [PATCH] rhashtable: fix rht_for_each_entry_safe() endless loop Patrick McHardy
2015-01-21 11:43 ` Thomas Graf
2015-01-26  8:08 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.