From 1acb5a9fab662f65a3be4fd319832edfe98cff6e Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Fri, 12 Oct 2018 08:20:32 +0200 Subject: [PATCH] [NTOSKRNL] Don't keep the spin lock hold too long when we lost the BCB race This will avoid a deadlock on unpin. --- ntoskrnl/cc/pin.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ntoskrnl/cc/pin.c b/ntoskrnl/cc/pin.c index bba87960c3c..b3906a9321f 100644 --- a/ntoskrnl/cc/pin.c +++ b/ntoskrnl/cc/pin.c @@ -385,6 +385,8 @@ CcPinRead ( iBcb = CcpFindBcb(SharedCacheMap, FileOffset, Length, TRUE); if (iBcb != NULL) { + KeReleaseSpinLock(&SharedCacheMap->BcbSpinLock, OldIrql); + /* Free our now unused BCB */ CcUnpinData(*Bcb); @@ -414,8 +416,8 @@ CcPinRead ( /* Insert ourselves in the linked list */ InsertTailList(&SharedCacheMap->BcbList, &iBcb->BcbEntry); + KeReleaseSpinLock(&SharedCacheMap->BcbSpinLock, OldIrql); } - KeReleaseSpinLock(&SharedCacheMap->BcbSpinLock, OldIrql); } /* We found a BCB, lock it and return it */ else