diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2010-12-23 12:32:46 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-12-23 12:32:46 -0500 |
commit | 1bde5ac49398a064c753bb490535cfad89e99a5f (patch) | |
tree | 9a26c9da2be8e1a6eedc089dd7719e14ac9b184b /net/ipv4/tcp_ipv4.c | |
parent | b7e03ec9a6b9d0c0cb1e435026d46dfcd78e48ac (diff) |
tcp: fix listening_get_next()
Alexey Vlasov found /proc/net/tcp could sometime loop and display
millions of sockets in LISTEN state.
In 2.6.29, when we converted TCP hash tables to RCU, we left two
sk_next() calls in listening_get_next().
We must instead use sk_nulls_next() to properly detect an end of chain.
Reported-by: Alexey Vlasov <renton@renton.name>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_ipv4.c')
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index e13da6de1fc7..d978bb2f748b 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -2030,7 +2030,7 @@ static void *listening_get_next(struct seq_file *seq, void *cur) | |||
2030 | get_req: | 2030 | get_req: |
2031 | req = icsk->icsk_accept_queue.listen_opt->syn_table[st->sbucket]; | 2031 | req = icsk->icsk_accept_queue.listen_opt->syn_table[st->sbucket]; |
2032 | } | 2032 | } |
2033 | sk = sk_next(st->syn_wait_sk); | 2033 | sk = sk_nulls_next(st->syn_wait_sk); |
2034 | st->state = TCP_SEQ_STATE_LISTENING; | 2034 | st->state = TCP_SEQ_STATE_LISTENING; |
2035 | read_unlock_bh(&icsk->icsk_accept_queue.syn_wait_lock); | 2035 | read_unlock_bh(&icsk->icsk_accept_queue.syn_wait_lock); |
2036 | } else { | 2036 | } else { |
@@ -2039,7 +2039,7 @@ get_req: | |||
2039 | if (reqsk_queue_len(&icsk->icsk_accept_queue)) | 2039 | if (reqsk_queue_len(&icsk->icsk_accept_queue)) |
2040 | goto start_req; | 2040 | goto start_req; |
2041 | read_unlock_bh(&icsk->icsk_accept_queue.syn_wait_lock); | 2041 | read_unlock_bh(&icsk->icsk_accept_queue.syn_wait_lock); |
2042 | sk = sk_next(sk); | 2042 | sk = sk_nulls_next(sk); |
2043 | } | 2043 | } |
2044 | get_sk: | 2044 | get_sk: |
2045 | sk_nulls_for_each_from(sk, node) { | 2045 | sk_nulls_for_each_from(sk, node) { |