Skip to content

Commit

Permalink
net: dev: Fix non-RCU based lower dev walker
Browse files Browse the repository at this point in the history
netdev_walk_all_lower_dev is not properly walking the lower device
list.  Commit 1a3f060 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: 1a3f060 ("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>
  • Loading branch information
David Ahern authored and David S. Miller committed Oct 29, 2016
1 parent b917783 commit 46b5ab1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 46b5ab1

Please sign in to comment.