summaryrefslogtreecommitdiffstats
path: root/net/ipv6/addrconf.c
diff options
context:
space:
mode:
authorBen Hutchings <ben@decadent.org.uk>2010-06-26 11:37:47 +0000
committerDavid S. Miller <davem@davemloft.net>2010-06-30 10:28:43 -0700
commitf56619fc72407561b00c52244a2caa53d730bc4a (patch)
tree9201b8700d4f8e185def920261a3cb718494cdcb /net/ipv6/addrconf.c
parent5a9dbfe08ee17f0dc9ecff647eba3d04afa01200 (diff)
downloadblackbird-obmc-linux-f56619fc72407561b00c52244a2caa53d730bc4a.tar.gz
blackbird-obmc-linux-f56619fc72407561b00c52244a2caa53d730bc4a.zip
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 <piotr.lewandowski@gmail.com> Signed-off-by: Ben Hutchings <ben@decadent.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/addrconf.c')
-rw-r--r--net/ipv6/addrconf.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index c20a7c260a8f..51a273fe3d21 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;
OpenPOWER on IntegriCloud