vfio/mdev: Add missing reference counting to mdev_type
authorJason Gunthorpe <jgg@nvidia.com>
Tue, 6 Apr 2021 19:40:30 +0000 (16:40 -0300)
committerAlex Williamson <alex.williamson@redhat.com>
Wed, 7 Apr 2021 21:39:17 +0000 (15:39 -0600)
commit9a302449a58d45d0ef2aab686f64b35919bc604c
treef7716b02c40a3a9e58634786baee6ec67f6531dc
parenta9f8111d0b5f445d853345e6917c1781573e4ba9
vfio/mdev: Add missing reference counting to mdev_type

struct mdev_type holds a pointer to the kref'd object struct mdev_parent,
but doesn't hold the kref. The lifetime of the parent becomes implicit
because parent_remove_sysfs_files() is supposed to remove all the access
before the parent can be freed, but this is very hard to reason about.

Make it obviously correct by adding the missing get.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Message-Id: <7-v2-d36939638fc6+d54-vfio2_jgg@nvidia.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
drivers/vfio/mdev/mdev_sysfs.c