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

[Xen-devel] [PATCH] Fix leak after alloc_vm_area() at netback driver

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] Fix leak after alloc_vm_area() at netback driver
From: glommer@xxxxxxxxxx (Glauber de Oliveira Costa)
Date: Wed, 28 Dec 2005 10:29:32 +0000
Delivery-date: Wed, 28 Dec 2005 13:32:05 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.9i
Fix a leak occurring at netif_map(). The problem raised after allocating
both {rx,tx}_comms_area, and one (and just one) of them failed. As we
were
doing a single test for both, returning would leave one of them
allocated.

Signed-off-by: Glauber de Oliveira Costa <glommer@xxxxxxxxxx>

-- 
glommer
# HG changeset patch
# User root@kct
# Node ID 39858755eae9b9311caa134577783cd250efa22e
# Parent  90cc0a345997f7820950ea3f2523a9cba938929b
Fix a leak occurring at netif_map(). The problem raised after allocating
both {rx,tx}_comms_area, and one (and just one) of them failed. As we were
doing a single test for both, returning would leave one of them allocated.

Signed-off-by: Glauber de Oliveira Costa <glommer@xxxxxxxxxx>

diff -r 90cc0a345997 -r 39858755eae9 
linux-2.6-xen-sparse/drivers/xen/netback/interface.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/interface.c      Wed Dec 28 
12:42:41 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/interface.c      Wed Dec 28 
12:53:55 2005
@@ -196,9 +196,13 @@
                return 0;
 
        netif->tx_comms_area = alloc_vm_area(PAGE_SIZE);
+       if (netif->tx_comms_area == NULL)
+               return -ENOMEM;
        netif->rx_comms_area = alloc_vm_area(PAGE_SIZE);
-       if (netif->tx_comms_area == NULL || netif->rx_comms_area == NULL)
+       if (netif->rx_comms_area == NULL){
+               free_vm_area(netif->tx_comms_area);
                return -ENOMEM;
+       }
 
        err = map_frontend_pages(netif, tx_ring_ref, rx_ring_ref);
        if (err) {
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] Fix leak after alloc_vm_area() at netback driver, Glauber de Oliveira Costa <=