From: Ben Hutchings Date: Sat, 26 Jun 2010 11:37:47 +0000 (+0000) Subject: ipv6: Clamp reported valid_lft to a minimum of 0 X-Git-Tag: v2.6.36-rc1~571^2~407 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f56619fc72407561b00c52244a2caa53d730bc4a;p=profile%2Fivi%2Fkernel-adaptation-intel-automotive.git ipv6: Clamp reported valid_lft to a minimum of 0 Since addresses are only revalidated every 2 minutes, the reported valid_lft can underflow shortly before the address is deleted. Clamp it to a minimum of 0, as for prefered_lft. Reported-by: Piotr Lewandowski Signed-off-by: Ben Hutchings Signed-off-by: David S. Miller --- diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index c20a7c2..51a273f 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -3495,8 +3495,12 @@ static int inet6_fill_ifaddr(struct sk_buff *skb, struct inet6_ifaddr *ifa, preferred -= tval; else preferred = 0; - if (valid != INFINITY_LIFE_TIME) - valid -= tval; + if (valid != INFINITY_LIFE_TIME) { + if (valid > tval) + valid -= tval; + else + valid = 0; + } } } else { preferred = INFINITY_LIFE_TIME;