]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commit
Asyncsocket in low latency send mode may write into freed memory
authorOliver Kurth <okurth@vmware.com>
Wed, 10 Apr 2019 21:14:53 +0000 (14:14 -0700)
committerOliver Kurth <okurth@vmware.com>
Wed, 10 Apr 2019 21:14:53 +0000 (14:14 -0700)
commitd759ae5ecfcc6f1069decdb2511ec32bf12a1663
tree52ccbd7f94bceb4b06c52901bc3fc91f22935dcd
parent325e244951790d7a848281fdb0236b0f6ee26996
Asyncsocket in low latency send mode may write into freed memory

Blast service encounters access violation exception during scale tests
in AsyncTCPSocketSend() at bora\lib\asyncsocket\asyncsocket.c.

Root cause is asock refcount is not incremented before the inline
invocation of AsyncTCPSocketSendCallback() in the low latency send
mode and asock is accessed right after this invocation to decrement
inLowLatencySendCb counter. AsyncTCPSocketSendCallback() on error
would invoke error handler which in turn could close the asock
leading to freeing of asock.

Issue wouldn't happen if AsyncWebSocket impl guarded all of its
transport->send(transport) calls with AsyncSocketAddRef(transport)
and AsyncSocketRelease(transport) but isn't the case currently.

Fix is to add and release asock reference around the inline
invocation of AsyncTCPSocketSendCallback().
open-vm-tools/lib/asyncsocket/asyncsocket.c