]> git.karo-electronics.de Git - linux-beck.git/commitdiff
net: dev: Fix non-RCU based lower dev walker
authorDavid Ahern <dsa@cumulusnetworks.com>
Wed, 26 Oct 2016 20:21:33 +0000 (13:21 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 29 Oct 2016 19:50:30 +0000 (15:50 -0400)
netdev_walk_all_lower_dev is not properly walking the lower device
list.  Commit 1a3f060c1a47 made netdev_walk_all_lower_dev similar
to netdev_walk_all_upper_dev_rcu and netdev_walk_all_lower_dev_rcu
but failed to update its netdev_next_lower_dev iterator. This patch
fixes that.

Fixes: 1a3f060c1a47 ("net: Introduce new api for walking upper and
                     lower devices")
Reported-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
Tested-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/dev.c

index f55fb453601620ce255087d12c639e075d7b256f..6aa43cd8cbb5ff5e381d058455e5b907585e1f53 100644 (file)
@@ -5400,12 +5400,12 @@ static struct net_device *netdev_next_lower_dev(struct net_device *dev,
 {
        struct netdev_adjacent *lower;
 
-       lower = list_entry(*iter, struct netdev_adjacent, list);
+       lower = list_entry((*iter)->next, struct netdev_adjacent, list);
 
        if (&lower->list == &dev->adj_list.lower)
                return NULL;
 
-       *iter = lower->list.next;
+       *iter = &lower->list;
 
        return lower->dev;
 }