[ros-diffs] [cgutman] 41736: - Don't cancel already completed requests - Fix potential NULL pointer access - Actually disassociate the address file and connection in DispTdiDisassociateAddress - Insert new requests at the end of the list not the beginning

cgutman at svn.reactos.org cgutman at svn.reactos.org
Thu Jul 2 08:51:35 CEST 2009


Author: cgutman
Date: Thu Jul  2 10:51:34 2009
New Revision: 41736

URL: http://svn.reactos.org/svn/reactos?rev=41736&view=rev
Log:
 - Don't cancel already completed requests
 - Fix potential NULL pointer access
 - Actually disassociate the address file and connection in DispTdiDisassociateAddress
 - Insert new requests at the end of the list not the beginning

Modified:
    trunk/reactos/drivers/network/tcpip/tcpip/dispatch.c
    trunk/reactos/lib/drivers/ip/transport/tcp/accept.c
    trunk/reactos/lib/drivers/ip/transport/tcp/tcp.c

Modified: trunk/reactos/drivers/network/tcpip/tcpip/dispatch.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/tcpip/dispatch.c?rev=41736&r1=41735&r2=41736&view=diff
==============================================================================
--- trunk/reactos/drivers/network/tcpip/tcpip/dispatch.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/tcpip/tcpip/dispatch.c [iso-8859-1] Thu Jul  2 10:51:34 2009
@@ -85,15 +85,6 @@
     IoAcquireCancelSpinLock(&OldIrql);
 
     (void)IoSetCancelRoutine(Irp, NULL);
-
-    if (Irp->Cancel || TranContext->CancelIrps) {
-        /* The IRP has been cancelled */
-
-        TI_DbgPrint(DEBUG_IRP, ("IRP is cancelled.\n"));
-
-        Status = STATUS_CANCELLED;
-        Count  = 0;
-    }
 
     IoReleaseCancelSpinLock(OldIrql);
 
@@ -463,6 +454,12 @@
     TI_DbgPrint(MID_TRACE, ("No address file is asscociated.\n"));
     return STATUS_INVALID_PARAMETER;
   }
+
+  /* Remove this connection from the address file */
+  Connection->AddressFile->Connection = NULL;
+
+  /* Remove the address file from this connection */
+  Connection->AddressFile = NULL;
 
   return STATUS_SUCCESS;
 }

Modified: trunk/reactos/lib/drivers/ip/transport/tcp/accept.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/ip/transport/tcp/accept.c?rev=41736&r1=41735&r2=41736&view=diff
==============================================================================
--- trunk/reactos/lib/drivers/ip/transport/tcp/accept.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/ip/transport/tcp/accept.c [iso-8859-1] Thu Jul  2 10:51:34 2009
@@ -149,7 +149,7 @@
             Bucket->Request.RequestNotifyObject = Complete;
             Bucket->Request.RequestContext = Context;
             IoMarkIrpPending((PIRP)Context);
-            InsertHeadList( &Listener->ListenRequest, &Bucket->Entry );
+            InsertTailList( &Listener->ListenRequest, &Bucket->Entry );
         } else
             Status = STATUS_NO_MEMORY;
     }

Modified: trunk/reactos/lib/drivers/ip/transport/tcp/tcp.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/ip/transport/tcp/tcp.c?rev=41736&r1=41735&r2=41736&view=diff
==============================================================================
--- trunk/reactos/lib/drivers/ip/transport/tcp/tcp.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/ip/transport/tcp/tcp.c [iso-8859-1] Thu Jul  2 10:51:34 2009
@@ -588,6 +588,11 @@
          &RemoteAddress,
          &RemotePort);
 
+    if (!NT_SUCCESS(Status)) {
+        TI_DbgPrint(DEBUG_TCP, ("Could not AddrBuildAddress in TCPConnect\n"));
+        return Status;
+    }
+
     if (!(NCE = RouteGetRouteToDestination(&RemoteAddress)))
     {
         return STATUS_NETWORK_UNREACHABLE;
@@ -606,12 +611,6 @@
                 ("Connecting to address %x:%x\n",
                  RemoteAddress.Address.IPv4Address,
                  RemotePort));
-
-    if (!NT_SUCCESS(Status)) {
-        TI_DbgPrint(DEBUG_TCP, ("Could not AddrBuildAddress in TCPConnect\n"));
-        TcpipRecursiveMutexLeave( &TCPLock );
-        return Status;
-    }
 
     AddressToConnect.sin_family = AF_INET;
     AddressToBind = AddressToConnect;
@@ -645,7 +644,7 @@
             
             IoMarkIrpPending((PIRP)Context);
 			
-            InsertHeadList( &Connection->ConnectRequest, &Bucket->Entry );
+            InsertTailList( &Connection->ConnectRequest, &Bucket->Entry );
         }
     }
 



More information about the Ros-diffs mailing list