summaryrefslogtreecommitdiff
path: root/net/ipv4/udp_diag.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2015-01-24 00:02:40 +0300
committerDavid S. Miller <davem@davemloft.net>2015-01-27 11:02:41 +0300
commit86f3cddbc3037882414c7308973530167906b7e9 (patch)
treea763a5c75a0f5d53e4247422039c9b685226b158 /net/ipv4/udp_diag.c
parent7d63585bf0a6c99382f97a5af71c5b5547fb58a4 (diff)
downloadlinux-86f3cddbc3037882414c7308973530167906b7e9.tar.xz
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>
Diffstat (limited to 'net/ipv4/udp_diag.c')
-rw-r--r--net/ipv4/udp_diag.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/ipv4/udp_diag.c b/net/ipv4/udp_diag.c
index 7927db0a9279..4a000f1dd757 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;