From: Zhang Zekun zhangzekun11@huawei.com
hulk inclusion category: bugfix bugzilla: 187358, https://gitee.com/openeuler/kernel/issues/I5KD2A CVE: NA
---------------------------------
This reverts commit 75624b5bc0485778aef9f46ebbf5e5df3c0d054c.
This patch could cause double-free problem, when 'irqdomain' is failed to add, in which case, irq_domain_free_fwnode(fn) will be called twice.
Signed-off-by: Zhang Zekun zhangzekun11@huawei.com Reviewed-by: Weilong Chen chenweilong@huawei.com Signed-off-by: Yongqiang Liu liuyongqiang13@huawei.com --- drivers/iommu/intel_irq_remapping.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/drivers/iommu/intel_irq_remapping.c b/drivers/iommu/intel_irq_remapping.c index 276005451914..967450bd421a 100644 --- a/drivers/iommu/intel_irq_remapping.c +++ b/drivers/iommu/intel_irq_remapping.c @@ -539,7 +539,7 @@ static int intel_setup_irq_remapping(struct intel_iommu *iommu) irq_domain_free_fwnode(fn); if (!iommu->ir_domain) { pr_err("IR%d: failed to allocate irqdomain\n", iommu->seq_id); - goto out_free_fwnode; + goto out_free_bitmap; } iommu->ir_msi_domain = arch_create_remap_msi_irq_domain(iommu->ir_domain, @@ -563,7 +563,7 @@ static int intel_setup_irq_remapping(struct intel_iommu *iommu)
if (dmar_enable_qi(iommu)) { pr_err("Failed to enable queued invalidation\n"); - goto out_free_ir_domain; + goto out_free_bitmap; } }
@@ -587,14 +587,6 @@ static int intel_setup_irq_remapping(struct intel_iommu *iommu)
return 0;
-out_free_ir_domain: - if (iommu->ir_msi_domain) - irq_domain_remove(iommu->ir_msi_domain); - iommu->ir_msi_domain = NULL; - irq_domain_remove(iommu->ir_domain); - iommu->ir_domain = NULL; -out_free_fwnode: - irq_domain_free_fwnode(fn); out_free_bitmap: kfree(bitmap); out_free_pages: