Skip to content

Commit

Permalink
udp_diag: Fix socket skipping within chain
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Herbert Xu authored and David S. Miller committed Jan 27, 2015
1 parent 7d63585 commit 86f3cdd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion net/ipv4/udp_diag.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 86f3cdd

Please sign in to comment.