[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 1/2] amd/passthrough: Do not leak domain mappings from do_invalidate_dte()



>>> On 04.12.13 at 16:09, Andrew Cooper <andrew.cooper3@xxxxxxxxxx> 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


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.