]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
net/core: Do not clear VF index for node/port GUIDs query
authorLeon Romanovsky <leonro@mellanox.com>
Thu, 30 Jan 2020 12:59:49 +0000 (14:59 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 11 Feb 2020 12:36:35 +0000 (04:36 -0800)
[ Upstream commit 9fbf082f569980ddd7cab348e0a118678db0e47e ]

VF numbers were assigned to node_guid and port_guid, but cleared
right before such query calls were issued. It caused to return
node/port GUIDs of VF index 0 for all VFs.

Fixes: 30aad41721e0 ("net/core: Add support for getting VF GUIDs")
Reported-by: Adrian Chiris <adrianc@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/core/rtnetlink.c

index d9001b5c48eb4e1af583f2d186451be592622e9d..f02705ff0e5e6ed0a110d053e7d9d22d9e2588ce 100644 (file)
@@ -1241,6 +1241,8 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb,
                return 0;
 
        memset(&vf_vlan_info, 0, sizeof(vf_vlan_info));
+       memset(&node_guid, 0, sizeof(node_guid));
+       memset(&port_guid, 0, sizeof(port_guid));
 
        vf_mac.vf =
                vf_vlan.vf =
@@ -1289,8 +1291,6 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb,
                    sizeof(vf_trust), &vf_trust))
                goto nla_put_vf_failure;
 
-       memset(&node_guid, 0, sizeof(node_guid));
-       memset(&port_guid, 0, sizeof(port_guid));
        if (dev->netdev_ops->ndo_get_vf_guid &&
            !dev->netdev_ops->ndo_get_vf_guid(dev, vfs_num, &node_guid,
                                              &port_guid)) {