ia64/xen-unstable

changeset 1405:24e6ea32ed3c

bitkeeper revision 1.915 (40ab9035Tu7lOz9f8aWhpKXAF9q49Q)

Fix a page release bug in network backend.
author kaf24@scramble.cl.cam.ac.uk
date Wed May 19 16:49:57 2004 +0000 (2004-05-19)
parents d11b603a8ccf
children ba2029aefdd6
files xenolinux-2.4.26-sparse/arch/xen/drivers/netif/backend/main.c
line diff
     1.1 --- a/xenolinux-2.4.26-sparse/arch/xen/drivers/netif/backend/main.c	Wed May 19 14:21:21 2004 +0000
     1.2 +++ b/xenolinux-2.4.26-sparse/arch/xen/drivers/netif/backend/main.c	Wed May 19 16:49:57 2004 +0000
     1.3 @@ -574,9 +574,16 @@ static void net_tx_action(unsigned long 
     1.4          skb->dev      = netif->dev;
     1.5          skb->protocol = eth_type_trans(skb, skb->dev);
     1.6  
     1.7 -        /* Destructor information. */
     1.8 +        /*
     1.9 +         * Destructor information. We hideously abuse the 'mapping' pointer,
    1.10 +         * which isn't otherwise used by us. The page deallocator is modified
    1.11 +         * to interpret a non-NULL value as a destructor function to be called.
    1.12 +         * This works okay because in all other cases the pointer must be NULL
    1.13 +         * when the page is freed (normally Linux will explicitly bug out if
    1.14 +         * it sees otherwise.
    1.15 +         */
    1.16 +        page->mapping = (struct address_space *)netif_page_release;
    1.17          atomic_set(&page->count, 1);
    1.18 -        page->mapping = (struct address_space *)netif_page_release;
    1.19          pending_id[pending_idx] = txreq.id;
    1.20          pending_netif[pending_idx] = netif;
    1.21  
    1.22 @@ -595,6 +602,9 @@ static void netif_page_release(struct pa
    1.23      unsigned long flags;
    1.24      u16 pending_idx = page - virt_to_page(mmap_vstart);
    1.25  
    1.26 +    /* Stop the abuse. */
    1.27 +    page->mapping = NULL;
    1.28 +
    1.29      spin_lock_irqsave(&dealloc_lock, flags);
    1.30      dealloc_ring[MASK_PEND_IDX(dealloc_prod++)] = pending_idx;
    1.31      spin_unlock_irqrestore(&dealloc_lock, flags);