Re: [PATCH 14/14] vfio/mdev: add mdev available instance checking to the core

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 04, 2022 at 02:51:44PM +0200, Christoph Hellwig wrote:

> @@ -115,12 +116,15 @@ EXPORT_SYMBOL(mdev_unregister_parent);
>  static void mdev_device_release(struct device *dev)
>  {
>  	struct mdev_device *mdev = to_mdev_device(dev);
> +	struct mdev_parent *parent = mdev->type->parent;
>  
>  	/* Pairs with the get in mdev_device_create() */
>  	kobject_put(&mdev->type->kobj);
>  
>  	mutex_lock(&mdev_list_lock);
>  	list_del(&mdev->next);
> +	if (!parent->mdev_driver->get_available)
> +		parent->available_instances++;
>  	mutex_unlock(&mdev_list_lock);

I think the kobject_put() needs to be after this reference to parent
because mdev_type_release() will:

	put_device(type->parent->dev);

Which is potentially the last reference holding dev, and thus parent,
at this moment.

Jason



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux