Author: tfaber Date: Sat Jun 25 23:27:45 2016 New Revision: 71673
URL: http://svn.reactos.org/svn/reactos?rev=71673&view=rev Log: [NTOS:LPC] - Avoid dereferencing a null pointer in LpcpDeletePort. By Samuel Serapión. CORE-6850 #resolve
Modified: trunk/reactos/ntoskrnl/lpc/close.c
Modified: trunk/reactos/ntoskrnl/lpc/close.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/lpc/close.c?rev=71... ============================================================================== --- trunk/reactos/ntoskrnl/lpc/close.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/lpc/close.c [iso-8859-1] Sat Jun 25 23:27:45 2016 @@ -432,20 +432,20 @@
/* Dereference the object unless it's the same port */ if (ConnectionPort != Port) ObDereferenceObject(ConnectionPort); + + /* Check if this is a connection port with a server process */ + if (((Port->Flags & LPCP_PORT_TYPE_MASK) == LPCP_CONNECTION_PORT) && + (ConnectionPort->ServerProcess)) + { + /* Dereference the server process */ + ObDereferenceObject(ConnectionPort->ServerProcess); + ConnectionPort->ServerProcess = NULL; + } } else { /* Release the lock */ KeReleaseGuardedMutex(&LpcpLock); - } - - /* Check if this is a connection port with a server process */ - if (((Port->Flags & LPCP_PORT_TYPE_MASK) == LPCP_CONNECTION_PORT) && - (ConnectionPort->ServerProcess)) - { - /* Dereference the server process */ - ObDereferenceObject(ConnectionPort->ServerProcess); - ConnectionPort->ServerProcess = NULL; }
/* Free client security */