ia64/xen-unstable

changeset 11178:83003532d71f

[NET] back: Initialise first fragment properly

The first fragment is used to store the pending_idx of the leading
txreq if it doesn't fit in the head area. When it does fit into
the head we need to ensure that the first fragment contains a value
that is not equal to pending_idx as that's what we use to distinguish
between the two cases in a a number of places.

This patch sets the first fragment to ~0 which is not equal to any
valid pending_idx. Without this initialisation, we may double-free
a pending_idx if the first fragment happened to contain a value
equal to it (this usually happened with pending_idx 0).

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
author kfraser@localhost.localdomain
date Thu Aug 17 11:32:39 2006 +0100 (2006-08-17)
parents 3e75d9b1d556
children a774cbd38187
files linux-2.6-xen-sparse/drivers/xen/netback/netback.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c	Wed Aug 16 18:20:03 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c	Thu Aug 17 11:32:39 2006 +0100
     1.3 @@ -1218,6 +1218,9 @@ static void net_tx_action(unsigned long 
     1.4  			skb_shinfo(skb)->nr_frags++;
     1.5  			skb_shinfo(skb)->frags[0].page =
     1.6  				(void *)(unsigned long)pending_idx;
     1.7 +		} else {
     1.8 +			/* Discriminate from any valid pending_idx value. */
     1.9 +			skb_shinfo(skb)->frags[0].page = (void *)~0UL;
    1.10  		}
    1.11  
    1.12  		__skb_queue_tail(&tx_queue, skb);