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>] [day] [month] [year] [list]
Message-ID: <A2975661238FB949B60364EF0F2C25743A0B5600@SHSMSX104.ccr.corp.intel.com>
Date:   Mon, 30 Sep 2019 12:40:59 +0000
From:   "Liu, Yi L" <yi.l.liu@...el.com>
To:     "alex.williamson@...hat.com" <alex.williamson@...hat.com>
CC:     "kwankhede@...dia.com" <kwankhede@...dia.com>,
        "Tian, Kevin" <kevin.tian@...el.com>,
        "baolu.lu@...ux.intel.com" <baolu.lu@...ux.intel.com>,
        "Sun, Yi Y" <yi.y.sun@...el.com>,
        "joro@...tes.org" <joro@...tes.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
        "Zhao, Yan Y" <yan.y.zhao@...el.com>,
        "He, Shaopeng" <shaopeng.he@...el.com>,
        "Xia, Chenbo" <chenbo.xia@...el.com>,
        "Tian, Jun J" <jun.j.tian@...el.com>
Subject: Re: [PATCH v2 12/13] vfio/type1: use iommu_attach_group() for
 wrapping PF/VF as mdev

Hi Alex,

> From: Alex Williamson [mailto:alex.williamson@...hat.com]
> Sent: Thursday, September 26, 2019 10:37 AM
> To: Liu, Yi L <yi.l.liu@...el.com>
> Subject: Re: [PATCH v2 12/13] vfio/type1: use iommu_attach_group() for wrapping
> PF/VF as mdev
> 
> On Thu,  5 Sep 2019 15:59:29 +0800
> Liu Yi L <yi.l.liu@...el.com> wrote:
> 
> > This patch uses iommu_attach_group() to do group attach when it is for
> > the case of wrapping a PF/VF as a mdev. iommu_attach_device() doesn't
> > support non-singleton iommu group attach. With this change, wrapping
> > PF/VF as mdev can work on non-singleton iommu groups.
> >
> > Cc: Kevin Tian <kevin.tian@...el.com>
> > Cc: Lu Baolu <baolu.lu@...ux.intel.com>
> > Suggested-by: Alex Williamson <alex.williamson@...hat.com>
> > Signed-off-by: Liu Yi L <yi.l.liu@...el.com>
> > ---
> >  drivers/vfio/vfio_iommu_type1.c | 22 ++++++++++++++++++----
> >  1 file changed, 18 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/vfio/vfio_iommu_type1.c
> > b/drivers/vfio/vfio_iommu_type1.c index 054391f..317430d 100644
> > --- a/drivers/vfio/vfio_iommu_type1.c
> > +++ b/drivers/vfio/vfio_iommu_type1.c
> > @@ -1312,13 +1312,20 @@ static int vfio_mdev_attach_domain(struct
> > device *dev, void *data)  {
> >  	struct iommu_domain *domain = data;
> >  	struct device *iommu_device;
> > +	struct iommu_group *group;
> >
> >  	iommu_device = vfio_mdev_get_iommu_device(dev);
> >  	if (iommu_device) {
> >  		if (iommu_dev_feature_enabled(iommu_device,
> IOMMU_DEV_FEAT_AUX))
> >  			return iommu_aux_attach_device(domain, iommu_device);
> > -		else
> > -			return iommu_attach_device(domain, iommu_device);
> > +		else {
> > +			group = iommu_group_get(iommu_device);
> > +			if (!group) {
> > +				WARN_ON(1);
> 
> What's the value of the WARN_ON here and below?

Let me remove it.

> iommu_group_get() increments the kobject reference, looks like it's leaked.  Thanks,

Oops, yes, should use dev->iommu_group. Let me fix it.

> 
> Alex

Thanks,
Yi Liu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ