--- drivers/network/tcpip/tcpip/fileobjs.c +++ drivers/network/tcpip/tcpip/fileobjs.c @@ -105,12 +105,14 @@ PADDRESS_FILE Current = NULL; BOOLEAN Found = FALSE; - if (IsListEmpty(SearchContext->Next)) - return NULL; + TcpipAcquireSpinLock(&AddressFileListLock, &OldIrql); CurrentEntry = SearchContext->Next; - TcpipAcquireSpinLock(&AddressFileListLock, &OldIrql); + if (IsListEmpty(CurrentEntry)) { + TcpipReleaseSpinLock(&AddressFileListLock, OldIrql); + return NULL; + } while (CurrentEntry != &AddressFileListHead) { Current = CONTAINING_RECORD(CurrentEntry, ADDRESS_FILE, ListEntry); @@ -136,13 +138,13 @@ CurrentEntry = CurrentEntry->Flink; } + if (Found) + SearchContext->Next = CurrentEntry->Flink; + else + Current = NULL; + TcpipReleaseSpinLock(&AddressFileListLock, OldIrql); - - if (Found) { - SearchContext->Next = CurrentEntry->Flink; - return Current; - } else - return NULL; + return Current; } VOID AddrFileFree(