win-pvdrivers

changeset 893:77874f11a978

Clean up xennet properly on unload
author James Harper <james.harper@bendigoit.com.au>
date Thu Mar 17 21:43:00 2011 +1100 (2011-03-17)
parents bfc71a7b8911
children 0b79cfdae922
files xennet/xennet_rx.c
line diff
     1.1 --- a/xennet/xennet_rx.c	Thu Mar 17 11:13:20 2011 +1100
     1.2 +++ b/xennet/xennet_rx.c	Thu Mar 17 21:43:00 2011 +1100
     1.3 @@ -43,6 +43,10 @@ get_pb_from_freelist(struct xennet_info 
     1.4      return pb;
     1.5    }
     1.6  
     1.7 +  /* don't allocate a new one if we are shutting down */
     1.8 +  if (xi->shutting_down)
     1.9 +    return NULL;
    1.10 +    
    1.11    status = NdisAllocateMemoryWithTag(&pb, sizeof(shared_buffer_t), XENNET_POOL_TAG);
    1.12    if (status != STATUS_SUCCESS)
    1.13    {
    1.14 @@ -959,6 +963,7 @@ XenNet_BufferFree(struct xennet_info *xi
    1.15      xi->vectors.GntTbl_EndAccess(xi->vectors.context,
    1.16          pb->gref, FALSE, (ULONG)'XNRX');
    1.17      NdisFreeMemory(pb->virtual, PAGE_SIZE, 0);
    1.18 +    NdisFreeMemory(pb, sizeof(shared_buffer_t), 0);
    1.19    }
    1.20  }
    1.21  
    1.22 @@ -1088,6 +1093,7 @@ XenNet_RxShutdown(xennet_info_t *xi)
    1.23  
    1.24    NdisDeleteNPagedLookasideList(&xi->rx_lookaside_list);
    1.25  
    1.26 +  stack_delete(xi->rx_pb_stack, NULL, NULL);
    1.27    //KeReleaseSpinLock(&xi->rx_lock, old_irql);
    1.28  
    1.29    FUNCTION_EXIT();