iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* [patch] iommu/vt-d: returning free pointer in get_domain_for_dev()
@ 2014-03-28  8:29 Dan Carpenter
  2014-03-28 20:37 ` David Woodhouse
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2014-03-28  8:29 UTC (permalink / raw)
  To: David Woodhouse; +Cc: Joerg Roedel, iommu, kernel-janitors

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>

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;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] iommu/vt-d: returning free pointer in get_domain_for_dev()
  2014-03-28  8:29 [patch] iommu/vt-d: returning free pointer in get_domain_for_dev() Dan Carpenter
@ 2014-03-28 20:37 ` David Woodhouse
  0 siblings, 0 replies; 2+ messages in thread
From: David Woodhouse @ 2014-03-28 20:37 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: kernel-janitors, iommu

[-- Attachment #1: Type: text/plain, Size: 845 bytes --]

On Fri, 2014-03-28 at 11:29 +0300, Dan Carpenter wrote:
> 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>
> 
> 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;

Applied; thanks.


-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse@intel.com                              Intel Corporation

[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 5745 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-03-28 20:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-28  8:29 [patch] iommu/vt-d: returning free pointer in get_domain_for_dev() Dan Carpenter
2014-03-28 20:37 ` David Woodhouse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).