]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Fix up HGFS server get packet buffer.
authorVMware, Inc <>
Tue, 26 Apr 2011 20:43:36 +0000 (13:43 -0700)
committerMarcelo Vanzin <mvanzin@vmware.com>
Tue, 26 Apr 2011 20:43:36 +0000 (13:43 -0700)
When guest mappings were being released the start index for the IOV
array was not correct it started from zero instead of the startIndex.
For meta packet the start index is zero, but for data packets it
is 16.

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

index 20f05da2dc70fe6713e3aeafa984d81090f293e1..b99e155e8d796e3876ba6ae62c455b699f5ac496 100644 (file)
@@ -291,11 +291,12 @@ HSPU_GetBuf(HgfsPacket *packet,           // IN/OUT: Hgfs Packet
    }
 
    if (iovMapped > 1) {
-      /* Seems like more than one page was requested. */
       uint32 copiedAmount = 0;
       uint32 copyAmount;
       int32 remainingSize;
       int i;
+
+      /* Seems like more than one page was requested. */
       ASSERT_DEVEL(packet->iov[startIndex].len < bufSize);
       *buf = Util_SafeMalloc(bufSize);
       *isAllocated = TRUE;
@@ -323,7 +324,7 @@ HSPU_GetBuf(HgfsPacket *packet,           // IN/OUT: Hgfs Packet
    }
 
 freeMem:
-   for (i = 0; i < iovCount; i++) {
+   for (i = startIndex; i < iovCount; i++) {
       session->channelCbTable->putVa(&packet->iov[i].token);
       packet->iov[i].va = NULL;
    }