]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
hgfsServerOplockMonitor.c HgfsOplockUnmonitorFileChange():
authorJohn Wolfe <jwolfe@vmware.com>
Tue, 22 Sep 2020 21:54:05 +0000 (14:54 -0700)
committerJohn Wolfe <jwolfe@vmware.com>
Tue, 22 Sep 2020 21:54:05 +0000 (14:54 -0700)
There is no need to cancel the monitor action if the oplock monitor
module has already been destroyed.   Avoid a possible NULL pointer
dereference.

open-vm-tools/lib/hgfsServer/hgfsServerOplockMonitor.c

index b19159b5c173d0527687a6f5a17a58646b26bbcf..1d97e5c454a1980d59f38818072389f66c53c63c 100644 (file)
@@ -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);