]> xenbits.xensource.com Git - libvirt.git/commitdiff
security: Don't try to lock NULL paths
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 24 Sep 2018 13:22:25 +0000 (15:22 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 26 Sep 2018 10:01:48 +0000 (12:01 +0200)
It may happen that in the list of paths/disk sources to relabel
there is a disk source. If that is the case, the path is NULL. In
that case, we shouldn't try to lock the path. It's likely a
network disk anyway and therefore there is nothing to lock.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
src/security/security_dac.c

index 5aea386e7c87578fd7238f2fdf3dcbca57c9b3e2..62442745dde5ebce61a710068dcfdfc13bc5edc4 100644 (file)
@@ -216,7 +216,8 @@ virSecurityDACTransactionRun(pid_t pid ATTRIBUTE_UNUSED,
     for (i = 0; i < list->nItems; i++) {
         const char *p = list->items[i]->path;
 
-        if (virFileIsDir(p))
+        if (!p ||
+            virFileIsDir(p))
             continue;
 
         VIR_APPEND_ELEMENT_COPY_INPLACE(paths, npaths, p);