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: <aHU/nVdsuxgRK+u4@Asurada-Nvidia>
Date: Mon, 14 Jul 2025 10:34:21 -0700
From: Nicolin Chen <nicolinc@...dia.com>
To: Jason Gunthorpe <jgg@...dia.com>
CC: Xu Yilun <yilun.xu@...ux.intel.com>, <kevin.tian@...el.com>,
	<will@...nel.org>, <aneesh.kumar@...nel.org>, <iommu@...ts.linux.dev>,
	<linux-kernel@...r.kernel.org>, <joro@...tes.org>, <robin.murphy@....com>,
	<shuah@...nel.org>, <aik@....com>, <dan.j.williams@...el.com>,
	<baolu.lu@...ux.intel.com>, <yilun.xu@...el.com>
Subject: Re: [PATCH v4 4/7] iommufd: Destroy vdevice on idevice destroy

On Mon, Jul 14, 2025 at 01:53:46PM -0300, Jason Gunthorpe wrote:
> On Tue, Jul 15, 2025 at 12:40:40AM +0800, Xu Yilun wrote:
> > diff --git a/drivers/iommu/iommufd/viommu.c b/drivers/iommu/iommufd/viommu.c
> > index 702ae248df17..bdd5a5227cbf 100644
> > --- a/drivers/iommu/iommufd/viommu.c
> > +++ b/drivers/iommu/iommufd/viommu.c
> > @@ -128,7 +128,8 @@ void iommufd_vdevice_destroy(struct iommufd_object *obj)
> >         mutex_lock(&idev->igroup->lock);
> >         iommufd_vdevice_abort(obj);
> >         mutex_unlock(&idev->igroup->lock);
> > -       iommufd_put_object(idev->ictx, &idev->obj);
> > +       refcount_dec(&idev->obj.shortterm_users);
> > +       wake_up_interruptible_all(&vdev->viommu->ictx->destroy_wait);
> >  }
> 
> I think the main point of keeping both refcounts is to keep the above
> hidden in the main functions and out of the object functions.

I see. Maybe we can just update the comments that we are keeping
both refcounts but using shortterm_users only to do the trick.

Otherwise, we'd need an iommufd_lock_obj_shortterm..

Thanks
Nicolin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ