Skip to content

Commit dd574d9

Browse files
jgunthorpeAlex Williamson
authored andcommitted
vfio/gvt: Fix open/close when multiple device FDs are open
The user can open multiple device FDs if it likes, however the open function calls vfio_register_notifier() on device global state. Calling vfio_register_notifier() twice will trigger a WARN_ON from notifier_chain_register() and the first close will wrongly delete the notifier and more. Since these really want the new open/close_device() semantics just change the function over. Reviewed-by: Zhenyu Wang <zhenyuw@linux.intel.com> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Link: https://lore.kernel.org/r/13-v4-9ea22c5e6afb+1adf-vfio_reflck_jgg@nvidia.com Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
1 parent 9b0d6b7 commit dd574d9

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

drivers/gpu/drm/i915/gvt/kvmgt.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -885,7 +885,7 @@ static int intel_vgpu_group_notifier(struct notifier_block *nb,
885885
return NOTIFY_OK;
886886
}
887887

888-
static int intel_vgpu_open(struct mdev_device *mdev)
888+
static int intel_vgpu_open_device(struct mdev_device *mdev)
889889
{
890890
struct intel_vgpu *vgpu = mdev_get_drvdata(mdev);
891891
struct kvmgt_vdev *vdev = kvmgt_vdev(vgpu);
@@ -1004,7 +1004,7 @@ static void __intel_vgpu_release(struct intel_vgpu *vgpu)
10041004
vgpu->handle = 0;
10051005
}
10061006

1007-
static void intel_vgpu_release(struct mdev_device *mdev)
1007+
static void intel_vgpu_close_device(struct mdev_device *mdev)
10081008
{
10091009
struct intel_vgpu *vgpu = mdev_get_drvdata(mdev);
10101010

@@ -1753,8 +1753,8 @@ static struct mdev_parent_ops intel_vgpu_ops = {
17531753
.create = intel_vgpu_create,
17541754
.remove = intel_vgpu_remove,
17551755

1756-
.open = intel_vgpu_open,
1757-
.release = intel_vgpu_release,
1756+
.open_device = intel_vgpu_open_device,
1757+
.close_device = intel_vgpu_close_device,
17581758

17591759
.read = intel_vgpu_read,
17601760
.write = intel_vgpu_write,

0 commit comments

Comments
 (0)