[3.13.y-ckt stable] Patch "net: core: Correct an over-stringent device loop detection." has been added to staging queue

Kamal Mostafa kamal at canonical.com
Wed Jun 17 21:27:54 UTC 2015


This is a note to let you know that I have just added a patch titled

    net: core: Correct an over-stringent device loop detection.

to the linux-3.13.y-queue branch of the 3.13.y-ckt extended stable tree 
which can be found at:

    http://kernel.ubuntu.com/git/ubuntu/linux.git/log/?h=linux-3.13.y-queue

This patch is scheduled to be released in version 3.13.11-ckt22.

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.13.y-ckt tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Thanks.
-Kamal

------

>From 6f76059865c2750e6e514c19ac6d3d0244f7c3e2 Mon Sep 17 00:00:00 2001
From: Vlad Yasevich <vyasevich at gmail.com>
Date: Sat, 2 May 2015 21:33:44 -0400
Subject: net: core: Correct an over-stringent device loop detection.

[ Upstream commit d66bf7dd27573ee5ea90484899ee952c19ccb194 ]

The code in __netdev_upper_dev_link() has an over-stringent
loop detection logic that actually prevents valid configurations
from working correctly.

In particular, the logic returns an error if an upper device
is already in the list of all upper devices for a given dev.
This particular check seems to be a overzealous as it disallows
perfectly valid configurations.  For example:
  # ip l a link eth0 name eth0.10 type vlan id 10
  # ip l a dev br0 typ bridge
  # ip l s eth0.10 master br0
  # ip l s eth0 master br0  <--- Will fail

If you switch the last two commands (add eth0 first), then both
will succeed.  If after that, you remove eth0 and try to re-add
it, it will fail!

It appears to be enough to simply check adj_list to keeps things
safe.

I've tried stacking multiple devices multiple times in all different
combinations, and either rx_handler registration prevented the stacking
of the device linking cought the error.

Signed-off-by: Vladislav Yasevich <vyasevic at redhat.com>
Acked-by: Jiri Pirko <jiri at resnulli.us>
Acked-by: Veaceslav Falico <vfalico at gmail.com>
Signed-off-by: David S. Miller <davem at davemloft.net>
Signed-off-by: Kamal Mostafa <kamal at canonical.com>
---
 net/core/dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 36e12a3..937fa81 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4832,7 +4832,7 @@ static int __netdev_upper_dev_link(struct net_device *dev,
 	if (__netdev_find_adj(upper_dev, dev, &upper_dev->all_adj_list.upper))
 		return -EBUSY;

-	if (__netdev_find_adj(dev, upper_dev, &dev->all_adj_list.upper))
+	if (__netdev_find_adj(dev, upper_dev, &dev->adj_list.upper))
 		return -EEXIST;

 	if (master && netdev_master_upper_dev_get(dev))
--
1.9.1





More information about the kernel-team mailing list