If we hit this error condition then we want to return a NULL pointer and
not a freed variable.

Signed-off-by: Dan Carpenter <[email protected]>

diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 6fbce01..69fa7da 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -2257,6 +2257,7 @@ static struct dmar_domain *get_domain_for_dev(struct 
device *dev, int gaw)
                goto error;
        if (iommu_attach_domain(domain, iommu)) {
                free_domain_mem(domain);
+               domain = NULL;
                goto error;
        }
        free = domain;
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to