lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <58182819.2050109@intel.com>
Date:   Tue, 01 Nov 2016 13:28:57 +0800
From:   Jike Song <jike.song@...el.com>
To:     Alex Williamson <alex.williamson@...hat.com>
CC:     Kirti Wankhede <kwankhede@...dia.com>, pbonzini@...hat.com,
        kraxel@...hat.com, cjia@...dia.com, qemu-devel@...gnu.org,
        kvm@...r.kernel.org, kevin.tian@...el.com,
        bjsdjshi@...ux.vnet.ibm.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v10 01/19] vfio: Mediated device Core driver

On 11/01/2016 11:44 AM, Alex Williamson wrote:
> On Tue, 01 Nov 2016 11:08:15 +0800
> Jike Song <jike.song@...el.com> wrote:
>> On 10/27/2016 05:29 AM, Kirti Wankhede wrote:
>>> +static int mdev_attach_iommu(struct mdev_device *mdev)
>>> +{
>>> +	int ret;
>>> +	struct iommu_group *group;
>>> +
>>> +	group = iommu_group_alloc();
>>> +	if (IS_ERR(group))
>>> +		return PTR_ERR(group);  
>>
>> Maybe I overthought, but where the iommu_group is released? On successful
>> return you already have a ref, I didn't find an iommu_group_put after that.
> ...
>>> +
>>> +	ret = iommu_group_add_device(group, &mdev->dev);
>>> +	if (ret)
>>> +		goto attach_fail;
>>> +
>>> +	dev_info(&mdev->dev, "MDEV: group_id = %d\n",
>>> +				 iommu_group_id(group));
>>> +attach_fail:
>>> +	iommu_group_put(group);
>>> +	return ret;
>>> +}
>>> +
>>> +static void mdev_detach_iommu(struct mdev_device *mdev)
>>> +{
>>> +	iommu_group_remove_device(&mdev->dev);
> 
> Here.  Adding a device to the group takes a group reference so we can
> 'put' the group to release the reference from the alloc as soon as a
> device is added.  When we remove the device, that reference is removed
> and this should result in a release of the group if all other
> references are balanced.  Thanks,

Now I understand, thanks :)

--
Thanks,
Jike

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ