[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y+VPXwjMhgWe/c0m@Asurada-Nvidia>
Date: Thu, 9 Feb 2023 11:54:07 -0800
From: Nicolin Chen <nicolinc@...dia.com>
To: Eric Farman <farman@...ux.ibm.com>
CC: <jgg@...dia.com>, <kevin.tian@...el.com>, <joro@...tes.org>,
<will@...nel.org>, <robin.murphy@....com>,
<alex.williamson@...hat.com>, <shuah@...nel.org>,
<yi.l.liu@...el.com>, <linux-kernel@...r.kernel.org>,
<iommu@...ts.linux.dev>, <kvm@...r.kernel.org>,
<linux-kselftest@...r.kernel.org>, <baolu.lu@...ux.intel.com>,
Matthew Rosato <mjrosato@...ux.ibm.com>
Subject: Re: [PATCH v2 03/10] iommufd: Create access in
vfio_iommufd_emulated_bind()
On Thu, Feb 09, 2023 at 01:58:47PM -0500, Eric Farman wrote:
> External email: Use caution opening links or attachments
>
>
> On Tue, 2023-02-07 at 13:17 -0800, Nicolin Chen wrote:
> ...snip...
> > diff --git a/drivers/vfio/iommufd.c b/drivers/vfio/iommufd.c
> > index 026f81a87dd7..dc9feab73db7 100644
> > --- a/drivers/vfio/iommufd.c
> > +++ b/drivers/vfio/iommufd.c
> > @@ -141,10 +141,19 @@ static const struct iommufd_access_ops
> > vfio_user_ops = {
> > int vfio_iommufd_emulated_bind(struct vfio_device *vdev,
> > struct iommufd_ctx *ictx, u32
> > *out_device_id)
> > {
> > + struct iommufd_access *user;
> > +
> > lockdep_assert_held(&vdev->dev_set->lock);
> >
> > - vdev->iommufd_ictx = ictx;
> > iommufd_ctx_get(ictx);
> > + user = iommufd_access_create(vdev->iommufd_ictx,
> > &vfio_user_ops, vdev);
> > + if (IS_ERR(user)) {
> > + iommufd_ctx_put(vdev->iommufd_ictx);
>
> Matthew noticed a vfio-ccw and -ap regression that blames this patch.
>
> Probably both the iommufd_access_create() and iommufd_ctx_put() calls
> want the ictx variable itself, instead of the (uninitialized) pointer
> in the vfio_device. (At least that gets -ccw and -ap working again.)
Oops. Yes, it should be:
iommufd_ctx_get(ictx);
user = iommufd_access_create(ictx, &vfio_user_ops, vdev);
if (IS_ERR(user)) {
iommufd_ctx_put(ictx);
Will fix in v3.
Thanks!
Nic
Powered by blists - more mailing lists