Re: [RFC 2/5] iommu/vt-d: Unlink device if failed to add to group
On 1/13/20 8:20 PM, Joerg Roedel wrote: On Sun, Jan 12, 2020 at 09:36:56AM +0800, Lu Baolu wrote: On 1/1/20 4:24 AM, Jon Derrick wrote: If the device fails to be added to the group, make sure to unlink the reference before returning. Signed-off-by: Jon Derrick Queued for v5.6. No need to do so, I sent it upstream with the last pile of iommu fixes. Got it. Thank you! Best regards, baolu ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
Re: [RFC 2/5] iommu/vt-d: Unlink device if failed to add to group
On Sun, Jan 12, 2020 at 09:36:56AM +0800, Lu Baolu wrote: > On 1/1/20 4:24 AM, Jon Derrick wrote: > > If the device fails to be added to the group, make sure to unlink the > > reference before returning. > > > > Signed-off-by: Jon Derrick > > Queued for v5.6. No need to do so, I sent it upstream with the last pile of iommu fixes. Thanks, Joerg ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
Re: [RFC 2/5] iommu/vt-d: Unlink device if failed to add to group
On 1/1/20 4:24 AM, Jon Derrick wrote: If the device fails to be added to the group, make sure to unlink the reference before returning. Signed-off-by: Jon Derrick Queued for v5.6. Best regards, baolu ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
Re: [RFC 2/5] iommu/vt-d: Unlink device if failed to add to group
On 1/1/20 4:24 AM, Jon Derrick wrote: If the device fails to be added to the group, make sure to unlink the reference before returning. Signed-off-by: Jon Derrick This fix looks reasonable to me. Acked-by: Lu Baolu Best regards, baolu --- drivers/iommu/intel-iommu.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index b2526a4..978d502 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c @@ -5625,8 +5625,10 @@ static int intel_iommu_add_device(struct device *dev) group = iommu_group_get_for_dev(dev); - if (IS_ERR(group)) - return PTR_ERR(group); + if (IS_ERR(group)) { + ret = PTR_ERR(group); + goto unlink; + } iommu_group_put(group); @@ -5652,7 +5654,8 @@ static int intel_iommu_add_device(struct device *dev) if (!get_private_domain_for_dev(dev)) { dev_warn(dev, "Failed to get a private domain.\n"); - return -ENOMEM; + ret = -ENOMEM; + goto unlink; } dev_info(dev, @@ -5667,6 +5670,10 @@ static int intel_iommu_add_device(struct device *dev) } return 0; + +unlink: + iommu_device_unlink(>iommu, dev); + return ret; } static void intel_iommu_remove_device(struct device *dev) ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
[RFC 2/5] iommu/vt-d: Unlink device if failed to add to group
If the device fails to be added to the group, make sure to unlink the reference before returning. Signed-off-by: Jon Derrick --- drivers/iommu/intel-iommu.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index b2526a4..978d502 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c @@ -5625,8 +5625,10 @@ static int intel_iommu_add_device(struct device *dev) group = iommu_group_get_for_dev(dev); - if (IS_ERR(group)) - return PTR_ERR(group); + if (IS_ERR(group)) { + ret = PTR_ERR(group); + goto unlink; + } iommu_group_put(group); @@ -5652,7 +5654,8 @@ static int intel_iommu_add_device(struct device *dev) if (!get_private_domain_for_dev(dev)) { dev_warn(dev, "Failed to get a private domain.\n"); - return -ENOMEM; + ret = -ENOMEM; + goto unlink; } dev_info(dev, @@ -5667,6 +5670,10 @@ static int intel_iommu_add_device(struct device *dev) } return 0; + +unlink: + iommu_device_unlink(>iommu, dev); + return ret; } static void intel_iommu_remove_device(struct device *dev) -- 1.8.3.1 ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu