Skip to content

Commit

Permalink
ipv6: Clamp reported valid_lft to a minimum of 0
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ben Hutchings authored and David S. Miller committed Jun 30, 2010
1 parent 5a9dbfe commit f56619f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions net/ipv6/addrconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f56619f

Please sign in to comment.