diff options
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/udp.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index e4cad11f284a..bf9519341fd3 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
@@ -99,7 +99,7 @@ static int udp_v6_get_port(struct sock *sk, unsigned short snum) | |||
99 | next:; | 99 | next:; |
100 | } | 100 | } |
101 | result = best; | 101 | result = best; |
102 | for(;; result += UDP_HTABLE_SIZE) { | 102 | for(i = 0; i < (1 << 16) / UDP_HTABLE_SIZE; i++, result += UDP_HTABLE_SIZE) { |
103 | if (result > sysctl_local_port_range[1]) | 103 | if (result > sysctl_local_port_range[1]) |
104 | result = sysctl_local_port_range[0] | 104 | result = sysctl_local_port_range[0] |
105 | + ((result - sysctl_local_port_range[0]) & | 105 | + ((result - sysctl_local_port_range[0]) & |
@@ -107,6 +107,8 @@ static int udp_v6_get_port(struct sock *sk, unsigned short snum) | |||
107 | if (!udp_lport_inuse(result)) | 107 | if (!udp_lport_inuse(result)) |
108 | break; | 108 | break; |
109 | } | 109 | } |
110 | if (i >= (1 << 16) / UDP_HTABLE_SIZE) | ||
111 | goto fail; | ||
110 | gotit: | 112 | gotit: |
111 | udp_port_rover = snum = result; | 113 | udp_port_rover = snum = result; |
112 | } else { | 114 | } else { |