Commit f56619fc authored by Ben Hutchings's avatar Ben Hutchings Committed by David S. Miller

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: default avatarPiotr Lewandowski <piotr.lewandowski@gmail.com>
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5a9dbfe0
...@@ -3495,8 +3495,12 @@ static int inet6_fill_ifaddr(struct sk_buff *skb, struct inet6_ifaddr *ifa, ...@@ -3495,8 +3495,12 @@ static int inet6_fill_ifaddr(struct sk_buff *skb, struct inet6_ifaddr *ifa,
preferred -= tval; preferred -= tval;
else else
preferred = 0; preferred = 0;
if (valid != INFINITY_LIFE_TIME) if (valid != INFINITY_LIFE_TIME) {
valid -= tval; if (valid > tval)
valid -= tval;
else
valid = 0;
}
} }
} else { } else {
preferred = INFINITY_LIFE_TIME; preferred = INFINITY_LIFE_TIME;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment