WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [Xen HV PATCH] VT-d: Fix resource leaks on error paths

To: Igor Mammedov <imammedo@xxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [Xen HV PATCH] VT-d: Fix resource leaks on error paths
From: Keir Fraser <keir@xxxxxxx>
Date: Thu, 12 May 2011 09:11:36 +0100
Cc: "Kay, Allen M" <allen.m.kay@xxxxxxxxx>, rhkernel-list@xxxxxxxxxx
Delivery-date: Thu, 12 May 2011 01:13:36 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:user-agent:date:subject:from:to:cc :message-id:thread-topic:thread-index:in-reply-to:mime-version :content-type:content-transfer-encoding; bh=7dRBSOOSh4maZEaGTlQia8zEVAIDetyYxhdFdD22Wew=; b=MxHMk5nUMVKxK0407ZKADT1rnaR+ZwWHS9r78szJvamRLa7AbP3jbLVmwfJQ+LuIFf vdPsqtoEYAgtRftrjjo++PI/MMNcd+mcZ4Vy2/6nQPXinaekFvEi5G6RBdZ8XADH/59y vomIbFgcCntmHI3pHxzxqQOit8jzdOeWV9VJE=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:user-agent:date:subject:from:to:cc:message-id:thread-topic :thread-index:in-reply-to:mime-version:content-type :content-transfer-encoding; b=WHZcuGpZKop0g6tgi4+0N5fWhI0vUkqh466uViNWEkb+cGnTVMMWRC0q43N2yLjvyH SUBodP/qe1TQEDt75neOcaLZPmChvWYvHn8LdPYLx0P51T76vNJCUltXGckRHmy1++tm 8YNnCBPUFq3YXtEbTpjbl6AkW64ggUIAGh5SI=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1305114354-14907-1-git-send-email-imammedo@xxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcwQfDZOWaq9K1OkJ0GMFsnYGB/zOg==
Thread-topic: [Xen-devel] [Xen HV PATCH] VT-d: Fix resource leaks on error paths
User-agent: Microsoft-Entourage/12.29.0.110113
Will need an Ack from a VT-d maintainer (Allen Kay is listed in our
MAINTAINERS file, and is CC'ed). Also needs a Signed-off-by line.

 -- Keir

On 11/05/2011 12:45, "Igor Mammedov" <imammedo@xxxxxxxxxx> wrote:

>       On error exit from function, maped pages should be unmapped
>       and acquired locks released.
> 
> diff -r 4b0692880dfa -r da93d9e43b3c xen/drivers/passthrough/vtd/intremap.c
> --- a/xen/drivers/passthrough/vtd/intremap.c Thu May 05 17:40:34 2011 +0100
> +++ b/xen/drivers/passthrough/vtd/intremap.c Wed May 11 12:29:54 2011 +0200
> @@ -210,7 +210,8 @@
>      if ( iremap_entries )
>          unmap_vtd_domain_page(iremap_entries);
>  
> -    ir_ctrl->iremap_num++;
> +    if ( i < IREMAP_ENTRY_NR )
> +     ir_ctrl->iremap_num++;
>      return i;
>  }
>  
> @@ -246,6 +247,8 @@
>          dprintk(XENLOG_ERR VTDPREFIX,
>                  "%s: index (%d) get an empty entry!\n",
>                  __func__, index);
> + unmap_vtd_domain_page(iremap_entries);
> + spin_unlock_irqrestore(&ir_ctrl->iremap_lock, flags);
>          return -EFAULT;
>      }
>  
> @@ -281,7 +284,8 @@
>      if ( index < 0 )
>      {
>          index = alloc_remap_entry(iommu);
> -        apic_pin_2_ir_idx[apic][ioapic_pin] = index;
> +        if ( index < IREMAP_ENTRY_NR )
> +            apic_pin_2_ir_idx[apic][ioapic_pin] = index;
>      }
>  
>      if ( index > IREMAP_ENTRY_NR - 1 )
> @@ -546,6 +550,8 @@
>          dprintk(XENLOG_ERR VTDPREFIX,
>                  "%s: index (%d) get an empty entry!\n",
>                  __func__, index);
> + unmap_vtd_domain_page(iremap_entries);
> + spin_unlock_irqrestore(&ir_ctrl->iremap_lock, flags);
>          return -EFAULT;
>      }
>  
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel