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: Fri, 4 Aug 2023 19:42:43 -0300
From: Jason Gunthorpe <jgg@...dia.com>
To: Brett Creeley <bcreeley@....com>
Cc: Brett Creeley <brett.creeley@....com>, kvm@...r.kernel.org,
	netdev@...r.kernel.org, alex.williamson@...hat.com,
	yishaih@...dia.com, shameerali.kolothum.thodi@...wei.com,
	kevin.tian@...el.com, simon.horman@...igine.com,
	shannon.nelson@....com
Subject: Re: [PATCH v13 vfio 3/7] vfio/pds: register with the pds_core PF

On Fri, Aug 04, 2023 at 12:21:21PM -0700, Brett Creeley wrote:
> > > > +int pds_vfio_register_client_cmd(struct pds_vfio_pci_device *pds_vfio)
> > > > +{
> > > > +     struct pci_dev *pdev = pds_vfio_to_pci_dev(pds_vfio);
> > > > +     char devname[PDS_DEVNAME_LEN];
> > > > +     int ci;
> > > > +
> > > > +     snprintf(devname, sizeof(devname), "%s.%d-%u",
> > > > PDS_VFIO_LM_DEV_NAME,
> > > > +              pci_domain_nr(pdev->bus),
> > > > +              PCI_DEVID(pdev->bus->number, pdev->devfn));
> > > > +
> > > > +     ci = pds_client_register(pci_physfn(pdev), devname);
> > > > +     if (ci < 0)
> > > > +             return ci;
> > > 
> > > This is not the right way to get the drvdata of a PCI PF from a VF,
> > > you must call pci_iov_get_pf_drvdata().
> > > 
> > > Jason
> > 
> > Okay, I will look at this and fix it up on the next version.
> 
> After taking another look this was intentional. I'm getting the PF pci_dev,
> not the PF's drvdata.

pds_client_register() gets the drvdata from the passed PCI function,
you have to use pci_iov_get_pf_drvdata() to do this. You can't
shortcut it like this.

This is all nonsensical, the existing callers start with aa pdsc:

int pdsc_auxbus_dev_add(struct pdsc *cf, struct pdsc *pf)

Then they call

	client_id = pds_client_register(pf->pdev, devname);

Which then does

	struct pdsc *pf;
	pf = pci_get_drvdata(pf_pdev);

Just pass in the pdsc you already had

Add another wrapper to get the pdsc from a VF using
pci_iov_get_pf_drvdata() like you are supposed to.

Jason

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ