Archive-only list for patches
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: "Tian, Kevin" <kevin.tian@intel.com>
Cc: "iommu@lists.linux.dev" <iommu@lists.linux.dev>,
	Lu Baolu <baolu.lu@linux.intel.com>,
	Eric Auger <eric.auger@redhat.com>,
	Lixiao Yang <lixiao.yang@intel.com>,
	Matthew Rosato <mjrosato@linux.ibm.com>,
	Nicolin Chen <nicolinc@nvidia.com>,
	"patches@lists.linux.dev" <patches@lists.linux.dev>,
	"syzbot+7574ebfe589049630608@syzkaller.appspotmail.com"
	<syzbot+7574ebfe589049630608@syzkaller.appspotmail.com>,
	"syzbot+d31adfb277377ef8fcba@syzkaller.appspotmail.com"
	<syzbot+d31adfb277377ef8fcba@syzkaller.appspotmail.com>,
	"Liu, Yi L" <yi.l.liu@intel.com>
Subject: Re: [PATCH rc v2 2/2] iommufd: Do not UAF during iommufd_put_object()
Date: Tue, 28 Nov 2023 21:03:09 -0400	[thread overview]
Message-ID: <20231129010309.GT436702@nvidia.com> (raw)
In-Reply-To: <BN9PR11MB5276CF21A13C701838CD309B8CBCA@BN9PR11MB5276.namprd11.prod.outlook.com>

On Tue, Nov 28, 2023 at 07:59:29AM +0000, Tian, Kevin wrote:
> > From: Jason Gunthorpe <jgg@nvidia.com>
> > Sent: Friday, November 24, 2023 8:50 PM
> > 
> > On Fri, Nov 24, 2023 at 06:48:59AM +0000, Tian, Kevin wrote:
> > > > From: Jason Gunthorpe <jgg@nvidia.com>
> > > > Sent: Wednesday, November 22, 2023 9:13 PM
> > > >
> > > > +		if (ret) {
> > > > +			/*
> > > > +			 * We have a bug. Put back the callers reference and
> > > > +			 * defer cleaning this object until close.
> > > > +			 */
> > > > +			refcount_dec(&to_destroy->users);
> > >
> > > explain why refcount_dec means 'put back'? also 'put back' is
> > > inconsistent with the earlier comment "In all cases the caller no
> > > longer has a users reference "
> > 
> > As above, "put back" means to have effectively done iommufd_put_object()
> > 
> 
> Probably just my English problem on the confusion that here 'put back'
> means removing the users refcnt of the caller while later 'put back'
> means adding back the shortterm refcnt in the error path:
> 
> +err_xa:
> +	if (zerod_shortterm) {
> +		/* Put back the xarray owned reference */
> +		refcount_set(&obj->shortterm_users, 1);
> +	}

Let's use the word 'restore' here instead of 'put back' :)

Thanks,
Jason

  reply	other threads:[~2023-11-29  1:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-22 13:13 [PATCH rc v2 0/2] Do not UAF during iommufd_put_object() Jason Gunthorpe
2023-11-22 13:13 ` [PATCH rc v2 1/2] iommufd: Add iommufd_ctx to iommufd_put_object() Jason Gunthorpe
2023-11-22 13:13 ` [PATCH rc v2 2/2] iommufd: Do not UAF during iommufd_put_object() Jason Gunthorpe
2023-11-24  6:48   ` Tian, Kevin
2023-11-24 12:50     ` Jason Gunthorpe
2023-11-28  7:59       ` Tian, Kevin
2023-11-29  1:03         ` Jason Gunthorpe [this message]
2023-11-30  0:37 ` [PATCH rc v2 0/2] " Jason Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231129010309.GT436702@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=eric.auger@redhat.com \
    --cc=iommu@lists.linux.dev \
    --cc=kevin.tian@intel.com \
    --cc=lixiao.yang@intel.com \
    --cc=mjrosato@linux.ibm.com \
    --cc=nicolinc@nvidia.com \
    --cc=patches@lists.linux.dev \
    --cc=syzbot+7574ebfe589049630608@syzkaller.appspotmail.com \
    --cc=syzbot+d31adfb277377ef8fcba@syzkaller.appspotmail.com \
    --cc=yi.l.liu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox