]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Avoid securing disk device info for ZFS pools (at this time)
authorOliver Kurth <okurth@vmware.com>
Wed, 11 Dec 2019 18:19:08 +0000 (10:19 -0800)
committerOliver Kurth <okurth@vmware.com>
Wed, 11 Dec 2019 18:19:08 +0000 (10:19 -0800)
ZFS filesystem pools device names can appear as single directory name
at the root directory.  The current logic to locate the
/sys/class/blocks/<device> PCI structure based on typical device name
format will fail for ZFS pools.  As an immediate fix to the SIGSEGV,
avoid attempting to locate the PCI info; keep vmtoolsd running.

Addresses https://github.com/vmware/open-vm-tools/issues/378

open-vm-tools/services/plugins/guestInfo/diskInfo.c

index a8234a4ca221b14df345b3de538c2b2ca88c893c..878276ce71805eaeb0878e167b258aed330f55b3 100644 (file)
@@ -825,10 +825,19 @@ GuestInfoGetDiskDevice(const char *fsName,
 
       /* Not an LVM; check if a basic block device. */
       char blockDevPath[PATH_MAX];
+      const char *baseDevName = strrchr(fsName, '/');
 
-      Str_Snprintf(blockDevPath, PATH_MAX,  "%s/%s", LINUX_SYS_BLOCK_DIR,
-                   strrchr(fsName, '/') + 1);
-      GuestInfoLinuxBlockDevice(blockDevPath, partEntry, 1 /* first and only*/);
+      /*
+       * ZFS pools are not currently handled and may consist of a simple file
+       * name.  Neither situation can currently be handled in the PCI device
+       * lookup; avoid at this time.
+       */
+      if (baseDevName != NULL && strcmp(partEntry->fsType, "zfs") != 0) {
+         Str_Snprintf(blockDevPath, PATH_MAX,  "%s/%s", LINUX_SYS_BLOCK_DIR,
+                      baseDevName + 1);
+         /* First and only disk device. */
+         GuestInfoLinuxBlockDevice(blockDevPath, partEntry, 1);
+      }
    }
 
    /*