direct-io.hg

changeset 8446:f36627941bbe

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@br.ibm.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed Dec 28 15:17:04 2005 +0100 (2005-12-28)
parents 0e47bcdac69d
children 188ef899e626
files linux-2.6-xen-sparse/drivers/xen/netback/interface.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/interface.c	Wed Dec 28 15:14:23 2005 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/interface.c	Wed Dec 28 15:17:04 2005 +0100
     1.3 @@ -196,9 +196,13 @@ int netif_map(netif_t *netif, unsigned l
     1.4  		return 0;
     1.5  
     1.6  	netif->tx_comms_area = alloc_vm_area(PAGE_SIZE);
     1.7 +	if (netif->tx_comms_area == NULL)
     1.8 +		return -ENOMEM;
     1.9  	netif->rx_comms_area = alloc_vm_area(PAGE_SIZE);
    1.10 -	if (netif->tx_comms_area == NULL || netif->rx_comms_area == NULL)
    1.11 +	if (netif->rx_comms_area == NULL) {
    1.12 +		free_vm_area(netif->tx_comms_area);
    1.13  		return -ENOMEM;
    1.14 +	}
    1.15  
    1.16  	err = map_frontend_pages(netif, tx_ring_ref, rx_ring_ref);
    1.17  	if (err) {