Author: tfaber Date: Wed Aug 10 11:19:59 2016 New Revision: 72184 URL: http://svn.reactos.org/svn/reactos?rev=72184&view=rev Log: [TCPIP] - Use pool tagging
Modified: trunk/reactos/drivers/network/tcpip/datalink/lan.c trunk/reactos/drivers/network/tcpip/include/tags.h trunk/reactos/drivers/network/tcpip/tcpip/iinfo.c trunk/reactos/drivers/network/tcpip/tcpip/ninfo.c Modified: trunk/reactos/drivers/network/tcpip/datalink/lan.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/datalink/lan.c?rev=72184&r1=72183&r2=72184&view=diff ============================================================================== --- trunk/reactos/drivers/network/tcpip/datalink/lan.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/tcpip/datalink/lan.c [iso-8859-1] Wed Aug 10 11:19:59 2016 @@ -138,8 +138,9 @@ ULONG BytesCopied; NDIS_STATUS Status; - HeaderBuffer = ExAllocatePool(NonPagedPool, - Adapter->HeaderSize); + HeaderBuffer = ExAllocatePoolWithTag(NonPagedPool, + Adapter->HeaderSize, + HEADER_TAG); if (!HeaderBuffer) return NDIS_STATUS_RESOURCES; @@ -151,7 +152,7 @@ if (BytesCopied != Adapter->HeaderSize) { /* Runt frame */ - ExFreePool(HeaderBuffer); + ExFreePoolWithTag(HeaderBuffer, HEADER_TAG); TI_DbgPrint(DEBUG_DATALINK, ("Runt frame (size %d).\n", BytesCopied)); return NDIS_STATUS_NOT_ACCEPTED; } @@ -161,7 +162,7 @@ BytesCopied, PacketType); - ExFreePool(HeaderBuffer); + ExFreePoolWithTag(HeaderBuffer, HEADER_TAG); return Status; } @@ -607,7 +608,7 @@ } else { - KeyValueInfo = ExAllocatePool(PagedPool, sizeof(KEY_VALUE_PARTIAL_INFORMATION) + 16 * sizeof(WCHAR)); + KeyValueInfo = ExAllocatePoolWithTag(PagedPool, sizeof(KEY_VALUE_PARTIAL_INFORMATION) + 16 * sizeof(WCHAR), KEY_VALUE_TAG); if (!KeyValueInfo) { ZwClose(ParameterHandle); @@ -696,6 +697,7 @@ } } + ExFreePoolWithTag(KeyValueInfo, KEY_VALUE_TAG); ZwClose(ParameterHandle); } @@ -823,7 +825,7 @@ if (!Adapter->Context) return; - Context = ExAllocatePool(NonPagedPool, sizeof(RECONFIGURE_CONTEXT)); + Context = ExAllocatePoolWithTag(NonPagedPool, sizeof(RECONFIGURE_CONTEXT), CONTEXT_TAG); if (!Context) return; @@ -836,7 +838,7 @@ if (Adapter->State == LAN_STATE_STARTED) { - ExFreePool(Context); + ExFreePoolWithTag(Context, CONTEXT_TAG); return; } @@ -848,7 +850,7 @@ if (Adapter->State == LAN_STATE_STOPPED) { - ExFreePool(Context); + ExFreePoolWithTag(Context, CONTEXT_TAG); return; } @@ -859,7 +861,7 @@ Adapter->OldState = Adapter->State; Adapter->State = LAN_STATE_RESETTING; /* Nothing else to do here */ - ExFreePool(Context); + ExFreePoolWithTag(Context, CONTEXT_TAG); return; case NDIS_STATUS_RESET_END: @@ -869,13 +871,13 @@ default: DbgPrint("Unhandled status: %x", GeneralStatus); - ExFreePool(Context); + ExFreePoolWithTag(Context, CONTEXT_TAG); return; } /* Queue the work item */ if (!ChewCreate(ReconfigureAdapterWorker, Context)) - ExFreePool(Context); + ExFreePoolWithTag(Context, CONTEXT_TAG); } VOID NTAPI ProtocolStatusComplete(NDIS_HANDLE NdisBindingContext) @@ -1108,8 +1110,8 @@ UnicodeString.MaximumLength = Information->DataLength; String->Buffer = - (PWCHAR)ExAllocatePool( NonPagedPool, - UnicodeString.MaximumLength + sizeof(WCHAR) ); + (PWCHAR)ExAllocatePoolWithTag( NonPagedPool, + UnicodeString.MaximumLength + sizeof(WCHAR), REG_STR_TAG ); if( !String->Buffer ) return STATUS_NO_MEMORY; @@ -1135,9 +1137,9 @@ BOOLEAN Deallocate) { NTSTATUS Status; UNICODE_STRING Ustr = *ResultFirst; - PWSTR new_string = ExAllocatePool + PWSTR new_string = ExAllocatePoolWithTag (PagedPool, - (ResultFirst->Length + Second->Length + sizeof(WCHAR))); + (ResultFirst->Length + Second->Length + sizeof(WCHAR)), TEMP_STRING_TAG); if( !new_string ) { return STATUS_NO_MEMORY; } @@ -1150,7 +1152,7 @@ new_string[ResultFirst->Length / sizeof(WCHAR)] = 0; Status = RtlCreateUnicodeString(ResultFirst,new_string) ? STATUS_SUCCESS : STATUS_NO_MEMORY; - ExFreePool(new_string); + ExFreePoolWithTag(new_string, TEMP_STRING_TAG); return Status; } @@ -1213,7 +1215,7 @@ NTSTATUS Status; ULONG i; KEY_BASIC_INFORMATION *Kbio = - ExAllocatePool(NonPagedPool, sizeof(KEY_BASIC_INFORMATION)); + ExAllocatePoolWithTag(NonPagedPool, sizeof(KEY_BASIC_INFORMATION), KBIO_TAG); ULONG KbioLength = sizeof(KEY_BASIC_INFORMATION), ResultLength; RtlInitUnicodeString( DeviceDesc, NULL ); @@ -1228,7 +1230,7 @@ if( !NT_SUCCESS(Status) ) { TI_DbgPrint(DEBUG_DATALINK,("Couldn't open Enum key %wZ: %x\n", &EnumKeyName, Status)); - ExFreePool( Kbio ); + ExFreePoolWithTag( Kbio, KBIO_TAG ); return Status; } @@ -1237,9 +1239,9 @@ Kbio, KbioLength, &ResultLength ); if( Status == STATUS_BUFFER_TOO_SMALL || Status == STATUS_BUFFER_OVERFLOW ) { - ExFreePool( Kbio ); + ExFreePoolWithTag( Kbio, KBIO_TAG ); KbioLength = ResultLength; - Kbio = ExAllocatePool( NonPagedPool, KbioLength ); + Kbio = ExAllocatePoolWithTag( NonPagedPool, KbioLength, KBIO_TAG ); if( !Kbio ) { TI_DbgPrint(DEBUG_DATALINK,("Failed to allocate memory\n")); ZwClose( EnumKey ); @@ -1252,7 +1254,7 @@ if( !NT_SUCCESS(Status) ) { TI_DbgPrint(DEBUG_DATALINK,("Couldn't enum key child %d\n", i)); ZwClose( EnumKey ); - ExFreePool( Kbio ); + ExFreePoolWithTag( Kbio, KBIO_TAG ); return Status; } } @@ -1266,14 +1268,14 @@ ( &EnumKeyName, &TargetKeyName, Name, DeviceDesc ); if( NT_SUCCESS(Status) ) { ZwClose( EnumKey ); - ExFreePool( Kbio ); + ExFreePoolWithTag( Kbio, KBIO_TAG ); return Status; } else Status = STATUS_SUCCESS; } } ZwClose( EnumKey ); - ExFreePool( Kbio ); + ExFreePoolWithTag( Kbio, KBIO_TAG ); return STATUS_UNSUCCESSFUL; } Modified: trunk/reactos/drivers/network/tcpip/include/tags.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/include/tags.h?rev=72184&r1=72183&r2=72184&view=diff ============================================================================== --- trunk/reactos/drivers/network/tcpip/include/tags.h [iso-8859-1] (original) +++ trunk/reactos/drivers/network/tcpip/include/tags.h [iso-8859-1] Wed Aug 10 11:19:59 2016 @@ -35,3 +35,12 @@ #define OSK_SMALL_TAG 'SKSO' #define LAN_ADAPTER_TAG ' NAL' #define WQ_CONTEXT_TAG 'noCW' +#define ROUTE_ENTRY_TAG 'erCT' +#define OUT_DATA_TAG 'doCT' +#define ARP_ENTRY_TAG 'raCT' +#define KBIO_TAG 'ikCT' +#define TEMP_STRING_TAG 'tsCT' +#define CONTEXT_TAG 'xcCT' +#define KEY_VALUE_TAG 'vkCT' +#define HEADER_TAG 'rhCT' +#define REG_STR_TAG 'srCT' Modified: trunk/reactos/drivers/network/tcpip/tcpip/iinfo.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/tcpip/iinfo.c?rev=72184&r1=72183&r2=72184&view=diff ============================================================================== --- trunk/reactos/drivers/network/tcpip/tcpip/iinfo.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/tcpip/tcpip/iinfo.c [iso-8859-1] Wed Aug 10 11:19:59 2016 @@ -35,7 +35,7 @@ ("Getting IFEntry MIB (IF %08x LA %08x) (%04x:%d)\n", Interface, IF, ID.tei_entity, ID.tei_instance)); - OutData = ExAllocatePool( NonPagedPool, FIELD_OFFSET(IFEntry, if_descr[MAX_ADAPTER_DESCRIPTION_LENGTH + 1])); + OutData = ExAllocatePoolWithTag( NonPagedPool, FIELD_OFFSET(IFEntry, if_descr[MAX_ADAPTER_DESCRIPTION_LENGTH + 1]), OUT_DATA_TAG ); if( !OutData ) return TDI_NO_RESOURCES; /* Out of memory */ @@ -95,7 +95,7 @@ ID.tei_entity, ID.tei_instance, Size)); Status = InfoCopyOut( (PCHAR)OutData, Size, Buffer, BufferSize ); - ExFreePool( OutData ); + ExFreePoolWithTag( OutData, OUT_DATA_TAG ); TI_DbgPrint(DEBUG_INFO,("Returning %x\n", Status)); @@ -113,14 +113,14 @@ if (MemSize != 0) { - ArpEntries = ExAllocatePool( NonPagedPool, MemSize ); + ArpEntries = ExAllocatePoolWithTag( NonPagedPool, MemSize, ARP_ENTRY_TAG ); if( !ArpEntries ) return STATUS_NO_MEMORY; NBCopyNeighbors( Interface, ArpEntries ); Status = InfoCopyOut( (PVOID)ArpEntries, MemSize, Buffer, BufferSize ); - ExFreePool( ArpEntries ); + ExFreePoolWithTag( ArpEntries, ARP_ENTRY_TAG ); } else { Modified: trunk/reactos/drivers/network/tcpip/tcpip/ninfo.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/tcpip/ninfo.c?rev=72184&r1=72183&r2=72184&view=diff ============================================================================== --- trunk/reactos/drivers/network/tcpip/tcpip/ninfo.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/tcpip/tcpip/ninfo.c [iso-8859-1] Wed Aug 10 11:19:59 2016 @@ -29,15 +29,15 @@ if (RtCount == 0) return InfoCopyOut(NULL, 0, NULL, BufferSize); - RouteEntries = ExAllocatePool( NonPagedPool, Size ); + RouteEntries = ExAllocatePoolWithTag( NonPagedPool, Size, ROUTE_ENTRY_TAG ); RtCurrent = RouteEntries; - RCache = ExAllocatePool( NonPagedPool, sizeof( FIB_ENTRY ) * RtCount ); + RCache = ExAllocatePoolWithTag( NonPagedPool, sizeof( FIB_ENTRY ) * RtCount, FIB_TAG ); RCacheCur = RCache; if( !RCache || !RouteEntries ) { - if( RCache ) ExFreePool( RCache ); - if( RouteEntries ) ExFreePool( RouteEntries ); + if( RCache ) ExFreePoolWithTag( RCache, FIB_TAG ); + if( RouteEntries ) ExFreePoolWithTag( RouteEntries, ROUTE_ENTRY_TAG ); return TDI_NO_RESOURCES; } @@ -87,8 +87,8 @@ Status = InfoCopyOut( (PCHAR)RouteEntries, Size, Buffer, BufferSize ); - ExFreePool( RouteEntries ); - ExFreePool( RCache ); + ExFreePoolWithTag( RouteEntries, ROUTE_ENTRY_TAG ); + ExFreePoolWithTag( RCache, FIB_TAG ); TI_DbgPrint(DEBUG_INFO, ("Returning %08x\n", Status)); @@ -122,7 +122,7 @@ return TDI_INVALID_PARAMETER; } - IPEntry = ExAllocatePool(NonPagedPool, sizeof(IPADDR_ENTRY)); + IPEntry = ExAllocatePoolWithTag(NonPagedPool, sizeof(IPADDR_ENTRY), IP_ADDRESS_TAG); if (!IPEntry) { TcpipReleaseSpinLock(&EntityListLock, OldIrql); @@ -147,7 +147,7 @@ InfoCopyOut((PCHAR)IPEntry, sizeof(IPADDR_ENTRY), Buffer, BufferSize); - ExFreePool(IPEntry); + ExFreePoolWithTag(IPEntry, IP_ADDRESS_TAG); return TDI_SUCCESS; }