rtnl: fix the loop index update error in rtnl_dump_ifinfo()
authorZhang Shengju <zhangshengju@cmss.chinamobile.com>
Sat, 19 Nov 2016 15:28:32 +0000 (23:28 +0800)
committerDavid S. Miller <davem@davemloft.net>
Sun, 20 Nov 2016 03:14:30 +0000 (22:14 -0500)
If the link is filtered out, loop index should also be updated. If not,
loop index will not be correct.

Fixes: dc599f76c22b0 ("net: Add support for filtering link dump by master device and kind")
Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Acked-by: David Ahern <dsa@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/rtnetlink.c

index 2b9d7d08ed4d0f7540914bbbb9e895e5fc1d9fe6..a99917b5de337b97792635675cbc0cf3a6916442 100644 (file)
@@ -1609,7 +1609,7 @@ static int rtnl_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
                head = &net->dev_index_head[h];
                hlist_for_each_entry(dev, head, index_hlist) {
                        if (link_dump_filtered(dev, master_idx, kind_ops))
-                               continue;
+                               goto cont;
                        if (idx < s_idx)
                                goto cont;
                        err = rtnl_fill_ifinfo(skb, dev, RTM_NEWLINK,