Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1363774

Re: [Patch V2 2/2] iommu: remove sysfs_link to device in iommu_group/devices when failed

From Alex Williamson <alex.williamson@redhat.com>
Newsgroups linux.kernel
Subject Re: [Patch V2 2/2] iommu: remove sysfs_link to device in iommu_group/devices when failed
Date 2016-03-24 00:10 +0100
Message-ID <rg04y-28c-7@gated-at.bofh.it> (permalink)
References <rfZrQ-1BS-7@gated-at.bofh.it> <rfZrQ-1BS-25@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, 23 Mar 2016 22:25:11 +0000
Wei Yang <richard.weiyang@gmail.com> wrote:

> The original code forgets to remove the sysfs_link to a device in
> iommu_group/devices directory, when the creation fails or conflicts on the
> name.
> 
> This patch tries to remove the sysfs_link on the failure.
> 
> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
> ---
>  drivers/iommu/iommu.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
> index 2696a38..8f480ba 100644
> --- a/drivers/iommu/iommu.c
> +++ b/drivers/iommu/iommu.c
> @@ -403,6 +403,7 @@ rename:
>  	ret = sysfs_create_link_nowarn(group->devices_kobj,
>  				       &dev->kobj, device->name);
>  	if (ret) {
> +		sysfs_remove_link(group->devices_kobj, device->name);
>  		kfree(device->name);
>  		if (ret == -EEXIST && i >= 0) {
>  			/*

If we failed to create a link, potentially due to a conflicting link
already present, then aren't we arbitrarily removing that conflicting
link with this change?  If sysfs_create_link_nowarn() fails then we
haven't created a link of our own to remove.  This looks wrong.  Thanks,

Alex

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[Patch V2 0/2] Cleanup on IOMMU Wei Yang <richard.weiyang@gmail.com> - 2016-03-23 23:30 +0100
  [Patch V2 1/2] iommu: remove the iommu_callback_data Wei Yang <richard.weiyang@gmail.com> - 2016-03-23 23:30 +0100
  [Patch V2 2/2] iommu: remove sysfs_link to device in iommu_group/devices when failed Wei Yang <richard.weiyang@gmail.com> - 2016-03-23 23:30 +0100
    Re: [Patch V2 2/2] iommu: remove sysfs_link to device in  iommu_group/devices when failed Alex Williamson <alex.williamson@redhat.com> - 2016-03-24 00:10 +0100
      Re: [Patch V2 2/2] iommu: remove sysfs_link to device in  iommu_group/devices when failed Wei Yang <richard.weiyang@gmail.com> - 2016-03-24 16:00 +0100

csiph-web