aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/addrconf.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv6/addrconf.c')
-rw-r--r--net/ipv6/addrconf.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 73a23b4130a5..4ea8cf7c0cc4 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1596,9 +1596,17 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len)
1596 not good. 1596 not good.
1597 */ 1597 */
1598 if (valid_lft >= 0x7FFFFFFF/HZ) 1598 if (valid_lft >= 0x7FFFFFFF/HZ)
1599 rt_expires = 0; 1599 rt_expires = 0x7FFFFFFF - (0x7FFFFFFF % HZ);
1600 else 1600 else
1601 rt_expires = jiffies + valid_lft * HZ; 1601 rt_expires = valid_lft * HZ;
1602
1603 /*
1604 * We convert this (in jiffies) to clock_t later.
1605 * Avoid arithmetic overflow there as well.
1606 * Overflow can happen only if HZ < USER_HZ.
1607 */
1608 if (HZ < USER_HZ && rt_expires > 0x7FFFFFFF / USER_HZ)
1609 rt_expires = 0x7FFFFFFF / USER_HZ;
1602 1610
1603 if (pinfo->onlink) { 1611 if (pinfo->onlink) {
1604 struct rt6_info *rt; 1612 struct rt6_info *rt;
@@ -1610,12 +1618,12 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len)
1610 ip6_del_rt(rt, NULL, NULL, NULL); 1618 ip6_del_rt(rt, NULL, NULL, NULL);
1611 rt = NULL; 1619 rt = NULL;
1612 } else { 1620 } else {
1613 rt->rt6i_expires = rt_expires; 1621 rt->rt6i_expires = jiffies + rt_expires;
1614 } 1622 }
1615 } 1623 }
1616 } else if (valid_lft) { 1624 } else if (valid_lft) {
1617 addrconf_prefix_route(&pinfo->prefix, pinfo->prefix_len, 1625 addrconf_prefix_route(&pinfo->prefix, pinfo->prefix_len,
1618 dev, rt_expires, RTF_ADDRCONF|RTF_EXPIRES|RTF_PREFIX_RT); 1626 dev, jiffies_to_clock_t(rt_expires), RTF_ADDRCONF|RTF_EXPIRES|RTF_PREFIX_RT);
1619 } 1627 }
1620 if (rt) 1628 if (rt)
1621 dst_release(&rt->u.dst); 1629 dst_release(&rt->u.dst);