lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20161209162148.44887938@xeon-e3>
Date:   Fri, 9 Dec 2016 16:21:48 -0800
From:   Stephen Hemminger <stephen@...workplumber.org>
To:     Haiyang Zhang <haiyangz@...rosoft.com>
Cc:     Greg KH <gregkh@...uxfoundation.org>,
        KY Srinivasan <kys@...rosoft.com>,
        "olaf@...fle.de" <olaf@...fle.de>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "bjorn.helgaas@...il.com" <bjorn.helgaas@...il.com>,
        "apw@...onical.com" <apw@...onical.com>,
        "devel@...uxdriverproject.org" <devel@...uxdriverproject.org>,
        "leann.ogasawara@...onical.com" <leann.ogasawara@...onical.com>,
        "jasowang@...hat.com" <jasowang@...hat.com>
Subject: Re: [PATCH 3/3] hv_netvsc: Implement VF matching based on serial
 numbers

On Fri, 9 Dec 2016 22:35:05 +0000
Haiyang Zhang <haiyangz@...rosoft.com> wrote:

> > > >
> > > > Emulated NIC is already excluded in start of netvc notifier handler.
> > > >
> > > > static int netvsc_netdev_event(struct notifier_block *this,
> > > > 			       unsigned long event, void *ptr)
> > > > {
> > > > 	struct net_device *event_dev = netdev_notifier_info_to_dev(ptr);
> > > >
> > > > 	/* Skip our own events */
> > > > 	if (event_dev->netdev_ops == &device_ops)
> > > > 		return NOTIFY_DONE;
> > > >  
> > >
> > > Emulated device is not based on netvsc. It's the native Linux  
> > (dec100M?)  
> > > Driver. So this line doesn't exclude it. And how about other NIC type
> > > may be added in the future?  
> > 
> > Sorry, forgot about that haven't used emulated device in years.
> > The emulated device should appear to be on a PCI bus, but the serial
> > would not match??  
> 
> It's not a vmbus device, not a hv_pci device either. Hv_PCI is a subset
> of vmbus devices. So emulated NIC won't have hv_pci serial number.
> 
> In my patch, the following code ensure, we only try to get serial number
> after confirming it's vmbus and hv_pci device:
> 
> +               if (!dev_is_vmbus(dev))
> +                       continue;
> +
> +               hdev = device_to_hv_device(dev);
> +               if (hdev->device_id != HV_PCIE)
> +                       continue;

Ok, the walk back up the device tree is logically ok, but I don't
know enough about PCI device tree to be assured that it is safe.
Also, you could short circuit away most of the unwanted devices
by making sure the vf_netdev->dev.parent is a PCI device.

Also the loop to look for serial number in the devices on the
hv_pci bus could be made a separate function and have a short circuit
return (although it probably doesn't matter since there will only
be on e PCI VF device per bus there).

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ