]> xenbits.xensource.com Git - libvirt.git/commitdiff
security: apparmor: Pass virStorageSource to add_file_path
authorCole Robinson <crobinso@redhat.com>
Tue, 8 Oct 2019 15:53:21 +0000 (11:53 -0400)
committerCole Robinson <crobinso@redhat.com>
Wed, 9 Oct 2019 18:17:16 +0000 (14:17 -0400)
The virStorageSource must have everything it needs

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
src/security/virt-aa-helper.c

index 7148e3c760957044cdb8c644f18fdb8118762e3f..9f39eb2e2b66adfecee53d236c391fcac697c09f 100644 (file)
@@ -911,20 +911,19 @@ file_iterate_pci_cb(virPCIDevicePtr dev ATTRIBUTE_UNUSED,
 }
 
 static int
-add_file_path(virDomainDiskDefPtr disk,
-              const char *path,
+add_file_path(virStorageSourcePtr src,
               size_t depth,
               virBufferPtr buf)
 {
     int ret;
 
     if (depth == 0) {
-        if (disk->src->readonly)
-            ret = vah_add_file(buf, path, "rk");
+        if (src->readonly)
+            ret = vah_add_file(buf, src->path, "rk");
         else
-            ret = vah_add_file(buf, path, "rwk");
+            ret = vah_add_file(buf, src->path, "rwk");
     } else {
-        ret = vah_add_file(buf, path, "rk");
+        ret = vah_add_file(buf, src->path, "rk");
     }
 
     if (ret != 0)
@@ -945,7 +944,7 @@ disk_add_files(virDomainDiskDefPtr disk,
         /* execute the callback only for local storage */
         if (virStorageSourceIsLocalStorage(tmp) &&
             tmp->path) {
-            if (add_file_path(disk, tmp->path, depth, buf) < 0)
+            if (add_file_path(tmp, depth, buf) < 0)
                 return -1;
         }