Commit 86f3cddbc3037882414c7308973530167906b7e9

Authored by Herbert Xu
Committed by David S. Miller
1 parent 7d63585bf0

udp_diag: Fix socket skipping within chain

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>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 1 changed file with 3 additions and 1 deletions Side-by-side Diff

... ... @@ -99,10 +99,12 @@
99 99 s_slot = cb->args[0];
100 100 num = s_num = cb->args[1];
101 101  
102   - for (slot = s_slot; slot <= table->mask; num = s_num = 0, slot++) {
  102 + for (slot = s_slot; slot <= table->mask; s_num = 0, slot++) {
103 103 struct sock *sk;
104 104 struct hlist_nulls_node *node;
105 105 struct udp_hslot *hslot = &table->hash[slot];
  106 +
  107 + num = 0;
106 108  
107 109 if (hlist_nulls_empty(&hslot->head))
108 110 continue;