win-pvdrivers

changeset 434:b6fb4cf3e0fa

additional checks for resource exhaustion
author James Harper <james.harper@bendigoit.com.au>
date Wed Oct 29 21:53:30 2008 +1100 (2008-10-29)
parents b1da81cc9868
children 29da24ccca8a
files xennet/xennet_tx.c
line diff
     1.1 --- a/xennet/xennet_tx.c	Tue Oct 14 10:45:56 2008 +1100
     1.2 +++ b/xennet/xennet_tx.c	Wed Oct 29 21:53:30 2008 +1100
     1.3 @@ -122,6 +122,18 @@ XenNet_HWSendPacket(struct xennet_info *
     1.4    RtlZeroMemory(&pi, sizeof(pi));
     1.5    NdisGetFirstBufferFromPacketSafe(packet, &in_mdl, &pi.header, &first_buffer_length, &total_length, NormalPagePriority);
     1.6    
     1.7 +  if (!pi.header)
     1.8 +  {
     1.9 +    KdPrint((__DRIVER_NAME "     NdisGetFirstBufferFromPacketSafe failed\n"));
    1.10 +    return FALSE;
    1.11 +  }
    1.12 +  
    1.13 +  if (!total_length)
    1.14 +  {
    1.15 +    KdPrint((__DRIVER_NAME "     Zero length packet\n"));
    1.16 +    return TRUE; // we don't want to see this packet again...
    1.17 +  }  
    1.18 +    
    1.19    csum_info = (PNDIS_TCP_IP_CHECKSUM_PACKET_INFO)&NDIS_PER_PACKET_INFO_FROM_PACKET(
    1.20      packet, TcpIpChecksumPacketInfo);
    1.21    mss = PtrToUlong(NDIS_PER_PACKET_INFO_FROM_PACKET(packet, TcpLargeSendPacketInfo));