From 14d405699634d4ce0adfc7b4f52ac7427220a98d Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Fri, 28 Mar 2014 11:29:50 +0300 Subject: [PATCH] iommu/vt-d: returning free pointer in get_domain_for_dev() If we hit this error condition then we want to return a NULL pointer and not a freed variable. Signed-off-by: Dan Carpenter Signed-off-by: David Woodhouse --- drivers/iommu/intel-iommu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 6fbce01b7875..69fa7da5e48b 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; -- GitLab