[ros-diffs] [weiden] 15989: - fixed a possible deadlock in SmBeginClientInitialization

weiden at svn.reactos.com weiden at svn.reactos.com
Fri Jun 17 18:26:17 CEST 2005


- fixed a possible deadlock in SmBeginClientInitialization
- fixed SmCompleteClientInitialization to return success when the client
data could be found
- don't copy the program name to a NULL pointer in SmCreateClient in
case allocating the storage failed
Modified: trunk/reactos/subsys/smss/client.c
  _____  

Modified: trunk/reactos/subsys/smss/client.c
--- trunk/reactos/subsys/smss/client.c	2005-06-17 16:12:33 UTC (rev
15988)
+++ trunk/reactos/subsys/smss/client.c	2005-06-17 16:26:04 UTC (rev
15989)
@@ -177,6 +177,7 @@

 		DPRINT("SM: %s: attempt to register again subsystem
%d.\n",
 			__FUNCTION__,
 			ConnectData->SubSystemId);
+		RtlLeaveCriticalSection (& SmpClientDirectory.Lock);
 		return STATUS_UNSUCCESSFUL;
 	}
 	DPRINT("SM: %s: registering subsystem ID=%d \n",
@@ -245,7 +246,7 @@
 NTSTATUS STDCALL
 SmCompleteClientInitialization (ULONG ProcessId)
 {
-	NTSTATUS        Status = STATUS_SUCCESS;
+	NTSTATUS        Status = STATUS_NOT_FOUND;
 	PSM_CLIENT_DATA Client = NULL;
 
 	DPRINT("SM: %s called\n", __FUNCTION__);
@@ -259,11 +260,11 @@
 			if (ProcessId == Client->ServerProcessId)
 			{
 				SmpSetClientInitialized (Client);
+				Status = STATUS_SUCCESS;
 				break;
 			}
 			Client = Client->Next;
 		}
-		Status = STATUS_NOT_FOUND;
 	}
 	RtlLeaveCriticalSection (& SmpClientDirectory.Lock);
 	return Status;
@@ -321,13 +322,14 @@
 			(HANDLE) ProcessInfo->ProcessHandle;
 		SmpClientDirectory.CandidateClient->ServerProcessId = 
 			(ULONG) ProcessInfo->ClientId.UniqueProcess;
+		/*
+		 * Copy the program name
+		 */
+		RtlCopyMemory
(SmpClientDirectory.CandidateClient->ProgramName,
+			       ProgramName,
+			       SM_SB_NAME_MAX_LENGTH);
 	}
-	/*
-	 * Copy the program name
-	 */
-	RtlCopyMemory (SmpClientDirectory.CandidateClient->ProgramName,
-		       ProgramName,
-		       SM_SB_NAME_MAX_LENGTH);
+
 	RtlLeaveCriticalSection (& SmpClientDirectory.Lock);
 	return Status;
 }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.reactos.org/pipermail/ros-diffs/attachments/20050617/e32d1b2b/attachment.html


More information about the Ros-diffs mailing list