public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: idosch@idosch.org
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, mlxsw@mellanox.com,
	dsa@cumulusnetworks.com, Ido Schimmel <idosch@mellanox.com>
Subject: [PATCH net-next] net: core: Traverse the adjacency list from first entry
Date: Wed, 26 Oct 2016 09:39:22 +0300	[thread overview]
Message-ID: <1477463962-2802-1-git-send-email-idosch@idosch.org> (raw)

From: Ido Schimmel <idosch@mellanox.com>

netdev_next_lower_dev() returns NULL when we finished traversing the
adjacency list ('iter' points to the list's head). Therefore, we must
start traversing the list from the first entry and not its head.

Fixes: 1a3f060c1a47 ("net: Introduce new api for walking upper and lower devices")
Signed-off-by: Ido Schimmel <idosch@mellanox.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 f55fb45..d9c937f 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5419,7 +5419,7 @@ int netdev_walk_all_lower_dev(struct net_device *dev,
 	struct list_head *iter;
 	int ret;
 
-	for (iter = &dev->adj_list.lower,
+	for (iter = dev->adj_list.lower.next,
 	     ldev = netdev_next_lower_dev(dev, &iter);
 	     ldev;
 	     ldev = netdev_next_lower_dev(dev, &iter)) {
-- 
2.7.4

             reply	other threads:[~2016-10-26  6:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-26  6:39 idosch [this message]
2016-10-26 15:05 ` [PATCH net-next] net: core: Traverse the adjacency list from first entry David Ahern
2016-10-26 15:52   ` Ido Schimmel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1477463962-2802-1-git-send-email-idosch@idosch.org \
    --to=idosch@idosch.org \
    --cc=davem@davemloft.net \
    --cc=dsa@cumulusnetworks.com \
    --cc=idosch@mellanox.com \
    --cc=mlxsw@mellanox.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox