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



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux