projects/linux·commit 87bf9c97

[IPV6]: Fix infinite loop in udp_v6_get_port().

87bf9c97 · YOSHIFUJI Hideaki <[email protected]> · 2005-10-04 13:00:39 -07:00

Signed-off-by: YOSHIFUJI Hideaki <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Commit
87bf9c97b4b3af8dec7b2b79cdfe7bfc0a0a03b2
Parents
dd7205ed

Changes

1 files changed · +3 −1

FileStatusAddDelContent
net/ipv6/udp.cmodified+3−1View file

net/ipv6/udp.c

View file
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index e4cad11..bf95193 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)
next:;
}
result = best;
- for(;; result += UDP_HTABLE_SIZE) {
+ for(i = 0; i < (1 << 16) / UDP_HTABLE_SIZE; i++, result += UDP_HTABLE_SIZE) {
if (result > sysctl_local_port_range[1])
result = sysctl_local_port_range[0]
+ ((result - sysctl_local_port_range[0]) &
@@ -107,6 +107,8 @@ static int udp_v6_get_port(struct sock *sk, unsigned short snum)
if (!udp_lport_inuse(result))
break;
}
+ if (i >= (1 << 16) / UDP_HTABLE_SIZE)
+ goto fail;
gotit:
udp_port_rover = snum = result;
} else {