From de546ef4ff3d288a260a93293177b3ef45c61e95 Mon Sep 17 00:00:00 2001 From: Dmitry Fleytman Date: Mon, 17 Feb 2014 15:52:42 +0200 Subject: [PATCH] UsbDk: CWdmList::ForEach() fix recursive lock acquisition Signed-off-by: Dmitry Fleytman --- UsbDk/UsbDkUtil.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/UsbDk/UsbDkUtil.h b/UsbDk/UsbDkUtil.h index 7f38e38..21f511a 100644 --- a/UsbDk/UsbDkUtil.h +++ b/UsbDk/UsbDkUtil.h @@ -96,8 +96,7 @@ public: TEntryType *Pop() { CLockedContext LockedContext(*this); - CounterDecrement(); - return TEntryType::GetByListEntry(RemoveHeadList(&m_List)); + return Pop_LockLess(); } ULONG Push(TEntryType *Entry) @@ -129,7 +128,7 @@ public: CLockedContext LockedContext(*this); while (!IsListEmpty(&m_List)) { - Functor(Pop()); + Functor(Pop_LockLess()); } } @@ -166,6 +165,12 @@ private: } } + TEntryType *Pop_LockLess() + { + CounterDecrement(); + return TEntryType::GetByListEntry(RemoveHeadList(&m_List)); + } + LIST_ENTRY m_List; ULONG m_NumEntries = 0; };