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 <dan.carpenter@oracle.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
This commit is contained in:
Dan Carpenter 2014-03-28 11:29:50 +03:00 committed by David Woodhouse
parent 63b4262478
commit 14d4056996
1 changed files with 1 additions and 0 deletions

View File

@ -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;