From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH 1/2] amd/passthrough: Do not leak domain mappings from do_invalidate_dte() Date: Wed, 4 Dec 2013 15:30:02 +0000 Message-ID: <529F4A7A.6000102@citrix.com> References: <1386169756-8406-1-git-send-email-andrew.cooper3@citrix.com> <1386169756-8406-2-git-send-email-andrew.cooper3@citrix.com> <529F56C6020000780010A191@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <529F56C6020000780010A191@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: Keir Fraser , Suravee Suthikulpanit , Xen-devel List-Id: xen-devel@lists.xenproject.org On 04/12/13 15:22, Jan Beulich wrote: >>>> On 04.12.13 at 16:09, Andrew Cooper wrote: >> --- 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; >> } > I think the better way to fix this would be to move > > glx = get_glx_from_dte(gdte); > gv = get_gv_from_dte(gdte); > > unmap_domain_page(dte_base); > > up ahead of the first exit path. > > Jan > So it would - v2 on its way. ~Andrew