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

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

ipv6 addrconf: Fix route lifetime setting in corner case.



Because of arithmetic overflow avoidance, the actual lifetime setting
(vs the value given by RA) did not increase monotonically around
0x7fffffff/HZ.

Signed-off-by: default avatarYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 44dc19c8
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -475,7 +475,7 @@ int rt6_route_rcv(struct net_device *dev, u8 *opt, int len,
	lifetime = ntohl(rinfo->lifetime);
	lifetime = ntohl(rinfo->lifetime);
	if (lifetime == 0xffffffff) {
	if (lifetime == 0xffffffff) {
		/* infinity */
		/* infinity */
	} else if (lifetime > 0x7fffffff/HZ) {
	} else if (lifetime > 0x7fffffff/HZ - 1) {
		/* Avoid arithmetic overflow */
		/* Avoid arithmetic overflow */
		lifetime = 0x7fffffff/HZ - 1;
		lifetime = 0x7fffffff/HZ - 1;
	}
	}