Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 87bf9c97 authored by YOSHIFUJI Hideaki's avatar YOSHIFUJI Hideaki Committed by David S. Miller
Browse files

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

parent dd7205ed
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -99,7 +99,7 @@ static int udp_v6_get_port(struct sock *sk, unsigned short snum)
		next:;
		next:;
		}
		}
		result = best;
		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])
			if (result > sysctl_local_port_range[1])
				result = sysctl_local_port_range[0]
				result = sysctl_local_port_range[0]
					+ ((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))
			if (!udp_lport_inuse(result))
				break;
				break;
		}
		}
		if (i >= (1 << 16) / UDP_HTABLE_SIZE)
			goto fail;
gotit:
gotit:
		udp_port_rover = snum = result;
		udp_port_rover = snum = result;
	} else {
	} else {