From: VMware, Inc <> Date: Tue, 26 Apr 2011 20:43:36 +0000 (-0700) Subject: Fix up HGFS server get packet buffer. X-Git-Tag: 2011.04.25-402641~55 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b11aab9cc326aee441a0a07db08f8e7987752a96;p=thirdparty%2Fopen-vm-tools.git Fix up HGFS server get packet buffer. 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 --- diff --git a/open-vm-tools/lib/hgfsServer/hgfsServerPacketUtil.c b/open-vm-tools/lib/hgfsServer/hgfsServerPacketUtil.c index 20f05da2d..b99e155e8 100644 --- a/open-vm-tools/lib/hgfsServer/hgfsServerPacketUtil.c +++ b/open-vm-tools/lib/hgfsServer/hgfsServerPacketUtil.c @@ -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; }