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]
Date:   Thu, 26 Mar 2020 09:17:05 -0300
From:   Jason Gunthorpe <jgg@...lanox.com>
To:     Jason Wang <jasowang@...hat.com>
Cc:     mst@...hat.com, linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
        virtualization@...ts.linux-foundation.org, netdev@...r.kernel.org,
        maxime.coquelin@...hat.com, cunming.liang@...el.com,
        zhihong.wang@...el.com, rob.miller@...adcom.com,
        xiao.w.wang@...el.com, lingshan.zhu@...el.com, eperezma@...hat.com,
        lulu@...hat.com, parav@...lanox.com, kevin.tian@...el.com,
        stefanha@...hat.com, rdunlap@...radead.org, hch@...radead.org,
        aadam@...hat.com, jiri@...lanox.com, shahafs@...lanox.com,
        hanand@...inx.com, mhabets@...arflare.com, gdawar@...inx.com,
        saugatm@...inx.com, vmireyno@...vell.com,
        Bie Tiwei <tiwei.bie@...el.com>
Subject: Re: [PATCH V8 9/9] virtio: Intel IFC VF driver for VDPA

On Thu, Mar 26, 2020 at 01:50:53PM +0800, Jason Wang wrote:

> > > +	adapter->vdpa.dma_dev = dev;
> > > +	ret = vdpa_register_device(&adapter->vdpa);
> > > +	if (ret) {
> > > +		IFCVF_ERR(adapter->dev, "Failed to register ifcvf to vdpa bus");
> > > +		goto err_msix;
> > > +	}
> > > +
> > > +	return 0;
> > > +
> > > +err_msix:
> > > +	put_device(&adapter->vdpa.dev);
> > > +	return ret;
> > > +err_alloc:
> > > +	pci_free_irq_vectors(pdev);
> > > +err_vectors:
> > > +	pci_release_regions(pdev);
> > > +err_regions:
> > > +	pci_disable_device(pdev);
> > > +err_enable:
> > > +	return ret;
> > > +}
> > I personally don't like seeing goto unwinds with multiple returns, and
> > here I think it is actually a tiny bug.
> > 
> > All touches to the PCI device must stop before the driver core
> > remove() returns - so these pci function cannot be in the kref put
> > release function anyhow.
> 
> 
> I'm not sure I get here. IFCVF held refcnt of its PCI parent, so it looks to
> me it's safe to free PCI resources in vDPA free callback?

The refcnt doesn't prevent the driver core from re-binding the
pci_device to another driver. Then the refcount put would do a
pci_disable_device() after another driver has started

For this reason all touches to a struct pci_device must stop before
remove returns.

Jason

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ