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:   Mon, 19 Feb 2018 12:43:21 -0700
From:   Alex Williamson <alex.williamson@...hat.com>
To:     Shameerali Kolothum Thodi <shameerali.kolothum.thodi@...wei.com>
Cc:     "eric.auger@...hat.com" <eric.auger@...hat.com>,
        "pmorel@...ux.vnet.ibm.com" <pmorel@...ux.vnet.ibm.com>,
        "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Linuxarm <linuxarm@...wei.com>,
        John Garry <john.garry@...wei.com>,
        "xuwei (O)" <xuwei5@...wei.com>
Subject: Re: [PATCH v3 2/6] vfio/type1: Check reserve region conflict and
 update iova list

On Mon, 19 Feb 2018 10:00:53 +0000
Shameerali Kolothum Thodi <shameerali.kolothum.thodi@...wei.com> wrote:

> > -----Original Message-----
> > From: Alex Williamson [mailto:alex.williamson@...hat.com]
> > Sent: Friday, February 16, 2018 9:18 PM
> > 
> > On Thu, 15 Feb 2018 09:45:00 +0000
> > Shameer Kolothum <shameerali.kolothum.thodi@...wei.com> wrote:
> > > +	iommu_get_group_resv_regions(iommu_group, &group_resv_regions);
> > > +
> > > +	if (vfio_iommu_resv_conflict(iommu, &group_resv_regions)) {
> > > +		ret = -EINVAL;
> > > +		goto out_detach;
> > > +	}
> > > +
> > >  	/* Get a copy of the current iova list and work on it */
> > >  	INIT_LIST_HEAD(&iova_copy);
> > >  	ret = vfio_iommu_get_iova_copy(iommu, &iova_copy);
> > > @@ -1437,6 +1512,10 @@ static int vfio_iommu_type1_attach_group(void  
> > *iommu_data,  
> > >  	if (ret)
> > >  		goto out_detach;
> > >
> > > +	ret = vfio_iommu_resv_exclude(&iova_copy, &group_resv_regions);
> > > +	if (ret)
> > > +		goto out_detach;
> > > +
> > >  	resv_msi = vfio_iommu_has_sw_msi(iommu_group, &resv_msi_base);
> > >
> > >  	INIT_LIST_HEAD(&domain->group_list);
> > > @@ -1497,6 +1576,9 @@ static int vfio_iommu_type1_attach_group(void  
> > *iommu_data,  
> > >  	/* Delete the old one and insert new iova list */
> > >  	vfio_iommu_insert_iova_copy(iommu, &iova_copy);
> > >
> > > +	list_for_each_entry_safe(resv, resv_next, &group_resv_regions, list)
> > > +		kfree(resv);  
> > 
> > list_del() here and below, also this can be done after the mutex unlock.  
> 
> Ok. I thought that as the reserved regions are local to this function, list_del() is
> not required.  Same for the iova_copy in the first patch as well(which I missed to
> comment there).

What you have works (afaik), it just seems sloppy to me to have free'd
entries in the list, even as the destructor, as this is not a
performance critical path.  Is this more common elsewhere in the kernel
than I suspect?  Thanks,

Alex

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ