diff options
author | Ben Hutchings <ben@decadent.org.uk> | 2010-06-26 07:37:47 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-06-30 13:28:43 -0400 |
commit | f56619fc72407561b00c52244a2caa53d730bc4a (patch) | |
tree | 9201b8700d4f8e185def920261a3cb718494cdcb /net/ipv6 | |
parent | 5a9dbfe08ee17f0dc9ecff647eba3d04afa01200 (diff) |
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')
-rw-r--r-- | net/ipv6/addrconf.c | 8 |
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, | |||
3495 | preferred -= tval; | 3495 | preferred -= tval; |
3496 | else | 3496 | else |
3497 | preferred = 0; | 3497 | preferred = 0; |
3498 | if (valid != INFINITY_LIFE_TIME) | 3498 | if (valid != INFINITY_LIFE_TIME) { |
3499 | valid -= tval; | 3499 | if (valid > tval) |
3500 | valid -= tval; | ||
3501 | else | ||
3502 | valid = 0; | ||
3503 | } | ||
3500 | } | 3504 | } |
3501 | } else { | 3505 | } else { |
3502 | preferred = INFINITY_LIFE_TIME; | 3506 | preferred = INFINITY_LIFE_TIME; |