netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* udp_diag: Fix socket skipping within chain
@ 2015-01-23 21:02 Herbert Xu
  2015-01-26 11:07 ` Pavel Emelyanov
  2015-01-27  8:03 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Herbert Xu @ 2015-01-23 21:02 UTC (permalink / raw)
  To: Pavel Emelyanov, netdev

While working on rhashtable walking I noticed that the UDP diag
dumping code is buggy.  In particular, the socket skipping within
a chain never happens, even though we record the number of sockets
that should be skipped.

As this code was supposedly copied from TCP, this patch does what
TCP does and resets num before we walk a chain.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

diff --git a/net/ipv4/udp_diag.c b/net/ipv4/udp_diag.c
index 7927db0..4a000f1 100644
--- a/net/ipv4/udp_diag.c
+++ b/net/ipv4/udp_diag.c
@@ -99,11 +99,13 @@ static void udp_dump(struct udp_table *table, struct sk_buff *skb, struct netlin
 	s_slot = cb->args[0];
 	num = s_num = cb->args[1];
 
-	for (slot = s_slot; slot <= table->mask; num = s_num = 0, slot++) {
+	for (slot = s_slot; slot <= table->mask; s_num = 0, slot++) {
 		struct sock *sk;
 		struct hlist_nulls_node *node;
 		struct udp_hslot *hslot = &table->hash[slot];
 
+		num = 0;
+
 		if (hlist_nulls_empty(&hslot->head))
 			continue;
 
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

* Re: udp_diag: Fix socket skipping within chain
  2015-01-23 21:02 udp_diag: Fix socket skipping within chain Herbert Xu
@ 2015-01-26 11:07 ` Pavel Emelyanov
  2015-01-27  8:03 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Pavel Emelyanov @ 2015-01-26 11:07 UTC (permalink / raw)
  To: Herbert Xu, netdev

On 01/24/2015 12:02 AM, Herbert Xu wrote:
> While working on rhashtable walking I noticed that the UDP diag
> dumping code is buggy.  In particular, the socket skipping within
> a chain never happens, even though we record the number of sockets
> that should be skipped.
> 
> As this code was supposedly copied from TCP, this patch does what
> TCP does and resets num before we walk a chain.
> 
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Acked-by: Pavel Emelyanov <xemul@parallels.com>

Thanks,
Pavel

> diff --git a/net/ipv4/udp_diag.c b/net/ipv4/udp_diag.c
> index 7927db0..4a000f1 100644
> --- a/net/ipv4/udp_diag.c
> +++ b/net/ipv4/udp_diag.c
> @@ -99,11 +99,13 @@ static void udp_dump(struct udp_table *table, struct sk_buff *skb, struct netlin
>  	s_slot = cb->args[0];
>  	num = s_num = cb->args[1];
>  
> -	for (slot = s_slot; slot <= table->mask; num = s_num = 0, slot++) {
> +	for (slot = s_slot; slot <= table->mask; s_num = 0, slot++) {
>  		struct sock *sk;
>  		struct hlist_nulls_node *node;
>  		struct udp_hslot *hslot = &table->hash[slot];
>  
> +		num = 0;
> +
>  		if (hlist_nulls_empty(&hslot->head))
>  			continue;
>  
> 

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

* Re: udp_diag: Fix socket skipping within chain
  2015-01-23 21:02 udp_diag: Fix socket skipping within chain Herbert Xu
  2015-01-26 11:07 ` Pavel Emelyanov
@ 2015-01-27  8:03 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2015-01-27  8:03 UTC (permalink / raw)
  To: herbert; +Cc: xemul, netdev

From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Sat, 24 Jan 2015 08:02:40 +1100

> While working on rhashtable walking I noticed that the UDP diag
> dumping code is buggy.  In particular, the socket skipping within
> a chain never happens, even though we record the number of sockets
> that should be skipped.
> 
> As this code was supposedly copied from TCP, this patch does what
> TCP does and resets num before we walk a chain.
> 
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Applied and queued up for -stable, thanks Herbert.

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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-23 21:02 udp_diag: Fix socket skipping within chain Herbert Xu
2015-01-26 11:07 ` Pavel Emelyanov
2015-01-27  8:03 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).