[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20161019132539.x2ou3hfgutxe6d57@dwarf.suse.cz>
Date: Wed, 19 Oct 2016 15:25:39 +0200
From: Jiri Bohac <jbohac@...e.cz>
To: David Miller <davem@...emloft.net>
Cc: julia.lawall@...6.fr, kuznet@....inr.ac.ru, jmorris@...ei.org,
yoshfuji@...ux-ipv6.org, kaber@...sh.net, netdev@...r.kernel.org,
kbuild-all@...org
Subject: Re: [PATCH] ipv6: don't check for tmp_prefered_lft underflow
The check for an underflow of tmp_prefered_lft is always false
because tmp_prefered_lft is unsigned.
The intention of the check was to guard against racing with an
update of the temp_prefered_lft sysctl, potentially resulting in
an underflow and a very large preferred lifetime. However, the
result of the check in such a situation would be not creating the
temporary address at all, which might be an even worse outcome
than the bogus lifetime.
Drop the faulty check.
Signed-off-by: Jiri Bohac <jbohac@...e.cz>
Reported-by: Julia Lawall <julia.lawall@...6.fr>
Fixes: 76506a986dc3 ("IPv6: fix DESYNC_FACTOR")
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index cc7c26d..f7c7c2b 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1247,9 +1247,6 @@ static int ipv6_create_tempaddr(struct inet6_ifaddr *ifp, struct inet6_ifaddr *i
idev->cnf.temp_valid_lft + age);
tmp_prefered_lft = idev->cnf.temp_prefered_lft + age -
idev->desync_factor;
- /* guard against underflow in case of concurrent updates to cnf */
- if (unlikely(tmp_prefered_lft < 0))
- tmp_prefered_lft = 0;
tmp_prefered_lft = min_t(__u32, ifp->prefered_lft, tmp_prefered_lft);
tmp_plen = ifp->prefix_len;
tmp_tstamp = ifp->tstamp;
--
Jiri Bohac <jbohac@...e.cz>
SUSE Labs, SUSE CZ
Powered by blists - more mailing lists