[ros-diffs] [cgutman] 54328: [NPFS] - Fix a potential CCB state inconsistency if the IRP is canceled before adding it to the pending list - Don't wait if the IRP has been canceled - Preserve the return status ...

cgutman at svn.reactos.org cgutman at svn.reactos.org
Mon Nov 7 01:37:36 UTC 2011


Author: cgutman
Date: Mon Nov  7 01:37:35 2011
New Revision: 54328

URL: http://svn.reactos.org/svn/reactos?rev=54328&view=rev
Log:
[NPFS]
- Fix a potential CCB state inconsistency if the IRP is canceled before adding it to the pending list
- Don't wait if the IRP has been canceled
- Preserve the return status of NpfsAddListeningServerInstance

Modified:
    trunk/reactos/drivers/filesystems/npfs/fsctrl.c

Modified: trunk/reactos/drivers/filesystems/npfs/fsctrl.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/npfs/fsctrl.c?rev=54328&r1=54327&r2=54328&view=diff
==============================================================================
--- trunk/reactos/drivers/filesystems/npfs/fsctrl.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/npfs/fsctrl.c [iso-8859-1] Mon Nov  7 01:37:35 2011
@@ -60,6 +60,7 @@
     IoAcquireCancelSpinLock(&oldIrql);
     if (!Irp->Cancel)
     {
+        Ccb->PipeState = FILE_PIPE_LISTENING_STATE;
         IoMarkIrpPending(Irp);
         InsertTailList(&Ccb->Fcb->WaiterListHead, &Entry->Entry);
         (void)IoSetCancelRoutine(Irp, NpfsListeningCancelRoutine);
@@ -174,21 +175,17 @@
     /* no listening client fcb found */
     DPRINT("No listening client fcb found -- waiting for client\n");
 
-    Ccb->PipeState = FILE_PIPE_LISTENING_STATE;
-
     Status = NpfsAddListeningServerInstance(Irp, Ccb);
 
     KeUnlockMutex(&Fcb->CcbListLock);
 
-    if (Flags & FO_SYNCHRONOUS_IO)
-    {
-        Status = KeWaitForSingleObject(&Ccb->ConnectEvent,
+    if ((Status == STATUS_PENDING) && (Flags & FO_SYNCHRONOUS_IO))
+    {
+        KeWaitForSingleObject(&Ccb->ConnectEvent,
             UserRequest,
             Irp->RequestorMode,
             (Flags & FO_ALERTABLE_IO),
             NULL);
-        if ((Status == STATUS_USER_APC) || (Status == STATUS_KERNEL_APC) || (Status == STATUS_ALERTED))
-            Status = STATUS_CANCELLED;
     }
 
     DPRINT("NpfsConnectPipe() done (Status %lx)\n", Status);




More information about the Ros-diffs mailing list