Re: [PATCH v3 10/17] iommufd: Reorganize iommufd_device_attach into iommufd_device_change_pt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 23, 2023 at 07:25:55AM +0000, Tian, Kevin wrote:
> > From: Jason Gunthorpe <jgg@xxxxxxxxxx>
> > Sent: Wednesday, March 22, 2023 3:15 AM
> > +int iommufd_device_attach(struct iommufd_device *idev, u32 *pt_id)
> > +{
> > +	int rc;
> > +
> > +	rc = iommufd_device_change_pt(idev, pt_id,
> > &iommufd_device_do_attach);
> > +	if (rc)
> > +		return rc;
> > +
> > +	/*
> > +	 * Pairs with iommufd_device_detach() - catches caller bugs
> > attempting
> > +	 * to destroy a device with an attachment.
> > +	 */
> > +	refcount_inc(&idev->obj.users);
> > +	return 0;
> 
> While it's the right thing to do I'm not sure what "catch caller bugs"
> mean here. There is no WARN_ON to catch.

The WARN_ON is on the destroy path of the device

	was_destroyed = iommufd_object_destroy_user(idev->ictx, &idev->obj);
	WARN_ON(!was_destroyed);

It is the idev we are incr'ing

Jason



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux