xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Keir Fraser <keir@xen.org>,
	Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>,
	Jan Beulich <JBeulich@suse.com>
Subject: [PATCH 1/2] amd/passthrough: Do not leak domain mappings from do_invalidate_dte()
Date: Wed, 4 Dec 2013 15:09:15 +0000	[thread overview]
Message-ID: <1386169756-8406-2-git-send-email-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <1386169756-8406-1-git-send-email-andrew.cooper3@citrix.com>

Coverity ID: 1135379

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Keir Fraser <keir@xen.org>
CC: Jan Beulich <JBeulich@suse.com>
CC: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
---
 xen/drivers/passthrough/amd/iommu_guest.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/drivers/passthrough/amd/iommu_guest.c b/xen/drivers/passthrough/amd/iommu_guest.c
index 952600a..7687cf1 100644
--- a/xen/drivers/passthrough/amd/iommu_guest.c
+++ b/xen/drivers/passthrough/amd/iommu_guest.c
@@ -433,7 +433,10 @@ static int do_invalidate_dte(struct domain *d, cmd_entry_t *cmd)
 
     /* Do not update host dte before gcr3 has been set */
     if ( gcr3_gfn == 0 )
+    {
+        unmap_domain_page(dte_base);
         return 0;
+    }
 
     gcr3_mfn = mfn_x(get_gfn(d, gcr3_gfn, &p2mt));
     put_gfn(d, gcr3_gfn);
@@ -446,6 +449,7 @@ static int do_invalidate_dte(struct domain *d, cmd_entry_t *cmd)
     {
         AMD_IOMMU_DEBUG("%s: Fail to find iommu for bdf %x!\n",
                         __func__, mbdf);
+        unmap_domain_page(dte_base);
         return -ENODEV;
     }
 
-- 
1.7.10.4

  reply	other threads:[~2013-12-04 15:09 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-04 15:09 [PATCH 0/2] Coverity fixes for map_domain_page() mismatches Andrew Cooper
2013-12-04 15:09 ` Andrew Cooper [this message]
2013-12-04 15:22   ` [PATCH 1/2] amd/passthrough: Do not leak domain mappings from do_invalidate_dte() Jan Beulich
2013-12-04 15:30     ` Andrew Cooper
2013-12-04 16:44     ` [PATCH v2 " Andrew Cooper
2013-12-04 16:49       ` Jan Beulich
2013-12-04 17:59         ` [PATCH v3 " Andrew Cooper
2013-12-06  8:37           ` Jan Beulich
2013-12-09 10:08           ` Jan Beulich
2013-12-09 18:33           ` Suravee Suthikulanit
2013-12-09 18:34             ` Andrew Cooper
2013-12-09 18:41             ` [PATCH v4 " Andrew Cooper
2013-12-09 20:02               ` Suravee Suthikulpanit
2013-12-04 15:09 ` [PATCH 2/2] xen/page_alloc: Defer the domain mapping in scrub_one_page() Andrew Cooper
2013-12-04 15:23   ` Jan Beulich
2013-12-09 10:09   ` Jan Beulich
2013-12-09 11:02     ` Keir Fraser

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1386169756-8406-2-git-send-email-andrew.cooper3@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=keir@xen.org \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).