RE: [PATCH v3] vfio: fix deadlock between group lock and kvm lock

From: Liu, Yi L
Date: Fri Feb 03 2023 - 09:48:37 EST


> From: Matthew Rosato <mjrosato@xxxxxxxxxxxxx>
> Sent: Friday, February 3, 2023 10:26 PM
>
> On 2/3/23 3:58 AM, Liu, Yi L wrote:
> > Hi Matthew,
> >
> ...
> >> * Can't pass group->kvm to vfio_device_open, as it references the value
> >> outside of new lock. Pass device->kvm to minimize changes in this
> >> fix (Alex, Yi)
> ...
> >> @@ -361,7 +420,6 @@ static int vfio_device_first_open(struct
> vfio_device
> >> *device,
> >> if (ret)
> >> goto err_module_put;
> >>
> >> - device->kvm = kvm;
> >
> > Since you've deleted the only usage of kvm pointer in this function, I
> > guess you can remove the kvm parameter from vfio_device_open()
> > and vfio_device_first_open(). :-) if it makes this patch too big, may
> > just have another patch to do it.
> >
>
> Hi Yi,
>
> Yeah, I mentioned it briefly (and vaguely I guess) in the cover, that was
> intentionally left out to reduce the patch size since this is a fix. I thought
> that was the consensus from the v2 comments anyway.
>
> If I end up doing a v4 for this I can just include the removal as a 2nd patch
> (without a fixes tag) and Alex can squash or keep separate as preferred -- if
> not you can feel free to do that removal with your cdev follow-up that
> exploits this work.

Sure. 😊

Regards,
Yi Liu