Skip to content

Commit

Permalink
hv_netvsc: ignore devices that are not PCI
Browse files Browse the repository at this point in the history
[ Upstream commit b93c1b5 ]

Registering another device with same MAC address (such as TAP, VPN or
DPDK KNI) will confuse the VF autobinding logic.  Restrict the search
to only run if the device is known to be a PCI attached VF.

Fixes: e8ff40d ("hv_netvsc: improve VF device matching")
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
shemminger authored and gregkh committed Sep 15, 2018
1 parent bf82c2c commit dadb011
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/net/hyperv/netvsc_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <linux/netdevice.h>
#include <linux/inetdevice.h>
#include <linux/etherdevice.h>
#include <linux/pci.h>
#include <linux/skbuff.h>
#include <linux/if_vlan.h>
#include <linux/in.h>
Expand Down Expand Up @@ -1895,11 +1896,15 @@ static int netvsc_register_vf(struct net_device *vf_netdev)
{
struct net_device *ndev;
struct net_device_context *net_device_ctx;
struct device *pdev = vf_netdev->dev.parent;
struct netvsc_device *netvsc_dev;

if (vf_netdev->addr_len != ETH_ALEN)
return NOTIFY_DONE;

if (!pdev || !dev_is_pci(pdev) || dev_is_pf(pdev))
return NOTIFY_DONE;

/*
* We will use the MAC address to locate the synthetic interface to
* associate with the VF interface. If we don't find a matching
Expand Down

0 comments on commit dadb011

Please sign in to comment.