Author: cgutman
Date: Mon Nov 7 00:52:32 2011
New Revision: 54327
URL:
http://svn.reactos.org/svn/reactos?rev=54327&view=rev
Log:
[NPFS]
- Fix several cancellation races and broken checks
Modified:
trunk/reactos/drivers/filesystems/npfs/create.c
trunk/reactos/drivers/filesystems/npfs/fsctrl.c
Modified: trunk/reactos/drivers/filesystems/npfs/create.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/npfs/c…
==============================================================================
--- trunk/reactos/drivers/filesystems/npfs/create.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/npfs/create.c [iso-8859-1] Mon Nov 7 00:52:32 2011
@@ -133,9 +133,11 @@
IoAcquireCancelSpinLock(&oldIrql);
if (!Irp->Cancel)
{
- (void)IoSetCancelRoutine(Irp, NULL);
- IoReleaseCancelSpinLock(oldIrql);
- return Waiter->Ccb;
+ if (IoSetCancelRoutine(Irp, NULL) != NULL)
+ {
+ IoReleaseCancelSpinLock(oldIrql);
+ return Waiter->Ccb;
+ }
}
IoReleaseCancelSpinLock(oldIrql);
}
@@ -868,11 +870,7 @@
RemoveEntryList(Entry);
tmpIrp = CONTAINING_RECORD(WaitEntry, IRP, Tail.Overlay.DriverContext);
IoAcquireCancelSpinLock(&oldIrql);
- if (!tmpIrp->Cancel)
- {
- (void)IoSetCancelRoutine(tmpIrp, NULL);
- Complete = TRUE;
- }
+ Complete = (NULL != IoSetCancelRoutine(tmpIrp, NULL));
IoReleaseCancelSpinLock(oldIrql);
if (Complete)
{
Modified: trunk/reactos/drivers/filesystems/npfs/fsctrl.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/npfs/f…
==============================================================================
--- trunk/reactos/drivers/filesystems/npfs/fsctrl.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/npfs/fsctrl.c [iso-8859-1] Mon Nov 7 00:52:32 2011
@@ -57,12 +57,11 @@
KeLockMutex(&Ccb->Fcb->CcbListLock);
- IoMarkIrpPending(Irp);
- InsertTailList(&Ccb->Fcb->WaiterListHead, &Entry->Entry);
-
IoAcquireCancelSpinLock(&oldIrql);
if (!Irp->Cancel)
{
+ IoMarkIrpPending(Irp);
+ InsertTailList(&Ccb->Fcb->WaiterListHead, &Entry->Entry);
(void)IoSetCancelRoutine(Irp, NpfsListeningCancelRoutine);
IoReleaseCancelSpinLock(oldIrql);
KeUnlockMutex(&Ccb->Fcb->CcbListLock);
@@ -289,7 +288,7 @@
{
RemoveEntryList(Entry);
Irp = CONTAINING_RECORD(Entry, IRP, Tail.Overlay.DriverContext);
- Complete = (NULL == IoSetCancelRoutine(Irp, NULL));
+ Complete = (NULL != IoSetCancelRoutine(Irp, NULL));
break;
}
Entry = Entry->Flink;