Skip to contentSkip to conversation

Patch "ipv6: correctly add local routes when lo goes up" has been added to the 4.8-stable tree

PATCH [email protected] 1 participant 1 message Nov 10, 2016

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

ipv6: correctly add local routes when lo goes up

to the 4.8-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
ipv6-correctly-add-local-routes-when-lo-goes-up.patch
and it can be found in the queue-4.8 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Thu Nov 10 16:43:03 CET 2016

From: Nicolas Dichtel <[email protected]>
Date: Wed, 12 Oct 2016 10:10:40 +0200
Subject: ipv6: correctly add local routes when lo goes up

From: Nicolas Dichtel <[email protected]>

[ Upstream commit a220445f9f4382c36a53d8ef3e08165fa27f7e2c ]

The goal of the patch is to fix this scenario:
ip link add dummy1 type dummy
ip link set dummy1 up
ip link set lo down ; ip link set lo up

After that sequence, the local route to the link layer address of dummy1 is not there anymore.

When the loopback is set down, all local routes are deleted by addrconf_ifdown()/rt6_ifdown(). At this time, the rt6_info entry still exists, because the corresponding idev has a reference on it. After the rcu grace period, dst_rcu_free() is called, and thus ___dst_free(), which will set obsolete to DST_OBSOLETE_DEAD.

In this case, init_loopback() is called before dst_rcu_free(), thus obsolete is still sets to something <= 0. So, the function doesn't add the route again. To avoid that race, let's check the rt6 refcnt instead.

Fixes 25fb6ca4ed9c ("net IPv6 : Fix broken IPv6 routing table after loopback down-up")
Fixes a881ae1f625c ("ipv6: don't call addrconf_dst_alloc again when enable lo")
Fixes 33d99113b110 ("ipv6: reallocate addrconf router for ipv6 address when lo device up")
CC Balakumaran Kannan <[email protected]>
CC Maruthi Thotad <[email protected]>
CC Sabrina Dubroca <[email protected]>
CC Hannes Frederic Sowa <[email protected]>
CC Weilong Chen <[email protected]>
CC Gao feng <[email protected]>
---
 net/ipv6/addrconf.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/addrconf.c +1 -1
@@ -2995,7 +2995,7 @@ static void init_loopback(struct net_dev
 				 * lo device down, release this obsolete dst and
 				 * reallocate a new router for ifa.
 				 */
-				if (sp_ifa->rt->dst.obsolete > 0) {
+				if (!atomic_read(&sp_ifa->rt->rt6i_ref)) {
 					ip6_rt_put(sp_ifa->rt);
 					sp_ifa->rt = NULL;
 				} else {

Patches currently in stable-queue which might be from [email protected] are

queue-4.8/ipv6-correctly-add-local-routes-when-lo-goes-up.patch