diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/udp.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 035915fc9ed3..cfff930f2baf 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -165,11 +165,14 @@ int __udp_lib_get_port(struct sock *sk, unsigned short snum, | |||
165 | goto gotit; | 165 | goto gotit; |
166 | } | 166 | } |
167 | size = 0; | 167 | size = 0; |
168 | sk_for_each(sk2, node, head) | 168 | sk_for_each(sk2, node, head) { |
169 | if (++size < best_size_so_far) { | 169 | if (++size >= best_size_so_far) |
170 | best_size_so_far = size; | 170 | goto next; |
171 | best = result; | 171 | } |
172 | } | 172 | best_size_so_far = size; |
173 | best = result; | ||
174 | next: | ||
175 | ; | ||
173 | } | 176 | } |
174 | result = best; | 177 | result = best; |
175 | for(i = 0; i < (1 << 16) / UDP_HTABLE_SIZE; i++, result += UDP_HTABLE_SIZE) { | 178 | for(i = 0; i < (1 << 16) / UDP_HTABLE_SIZE; i++, result += UDP_HTABLE_SIZE) { |