From: John Wolfe Date: Tue, 22 Sep 2020 21:54:05 +0000 (-0700) Subject: hgfsServerOplockMonitor.c HgfsOplockUnmonitorFileChange(): X-Git-Tag: stable-11.3.0~326 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bc811a0fcd6b80082fc7f513928e9c448e7bf46b;p=thirdparty%2Fopen-vm-tools.git hgfsServerOplockMonitor.c HgfsOplockUnmonitorFileChange(): There is no need to cancel the monitor action if the oplock monitor module has already been destroyed. Avoid a possible NULL pointer dereference. --- diff --git a/open-vm-tools/lib/hgfsServer/hgfsServerOplockMonitor.c b/open-vm-tools/lib/hgfsServer/hgfsServerOplockMonitor.c index b19159b5c..1d97e5c45 100644 --- a/open-vm-tools/lib/hgfsServer/hgfsServerOplockMonitor.c +++ b/open-vm-tools/lib/hgfsServer/hgfsServerOplockMonitor.c @@ -434,6 +434,16 @@ HgfsOplockUnmonitorFileChangeInternal(HOM_HANDLE handle) // IN: void HgfsOplockUnmonitorFileChange(HOM_HANDLE handle) // IN: { + /* + * This function is a callback function and may be called at any time, even + * when the oplock monitor module is destroyed. + * So, check if the oplock monitor module is initialized. + */ + if (!gOplockMonitorInit) { + Log("%s: OplockMonitor module is not inited\n", __FUNCTION__); + return; + } + MXUser_AcquireExclLock(oplockMonitorLock); HgfsOplockUnmonitorFileChangeInternal(handle); MXUser_ReleaseExclLock(oplockMonitorLock);