]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
HGFS node cache from causing the VMX to go into an infinite loop
authorVMware, Inc <>
Mon, 26 Apr 2010 18:22:02 +0000 (11:22 -0700)
committerMarcelo Vanzin <mvanzin@vmware.com>
Tue, 27 Apr 2010 03:48:52 +0000 (20:48 -0700)
If the HGFS server node cache becomes full and all the nodes are
of the type that cannot be foreclosed and so cannot be removed
the removal goes into an infinite loop.

Fix it by only checking the number of entries in the list and then
exiting with failure.

Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
open-vm-tools/lib/hgfsServer/hgfsServer.c

index 3218c702952cad8c603fd092db6309ba89888d1b..989fb8e2a3731b028bbd5006866e2594237d28c3 100644 (file)
@@ -4427,6 +4427,7 @@ HgfsRemoveLruNode(HgfsSessionInfo *session)   // IN: session info
    HgfsFileNode *lruNode = NULL;
    HgfsHandle handle;
    Bool found = FALSE;
+   uint32 numOpenNodes = session->numCachedOpenNodes;
 
    ASSERT(session);
    ASSERT(session->numCachedOpenNodes > 0);
@@ -4435,7 +4436,7 @@ HgfsRemoveLruNode(HgfsSessionInfo *session)   // IN: session info
     * Remove the first item from the list that does not have a server lock,
     * file context or is open in sequential mode.
     */
-   while (!found) {
+   while (!found && (numOpenNodes-- > 0)) {
       lruNode = DblLnkLst_Container(session->nodeCachedList.next,
                                     HgfsFileNode, links);