[libvirt] [PATCH] security: Don't overwrite error of GetProcessLabel

Cole Robinson posted 1 patch 6 years, 9 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/028a4c540436d1d1bdc805540bead745cbcbd9d8.1500506519.git.crobinso@redhat.com
src/lxc/lxc_driver.c   | 6 ++----
src/qemu/qemu_driver.c | 7 +------
2 files changed, 3 insertions(+), 10 deletions(-)
[libvirt] [PATCH] security: Don't overwrite error of GetProcessLabel
Posted by Cole Robinson 6 years, 9 months ago
Security impls of this function already raise errors, don't
overwrite them.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
---
 src/lxc/lxc_driver.c   | 6 ++----
 src/qemu/qemu_driver.c | 7 +------
 2 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 652e9cba0..088d3d20f 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -1348,11 +1348,9 @@ static int lxcDomainGetSecurityLabel(virDomainPtr dom, virSecurityLabelPtr secla
         }
 
         if (virSecurityManagerGetProcessLabel(driver->securityManager,
-                                              vm->def, priv->initpid, seclabel) < 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           "%s", _("Failed to get security label"));
+                                              vm->def, priv->initpid,
+                                              seclabel) < 0)
             goto cleanup;
-        }
     }
 
     ret = 0;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 8d261b725..62d5b8dfe 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -6111,11 +6111,8 @@ static int qemuDomainGetSecurityLabel(virDomainPtr dom, virSecurityLabelPtr secl
      */
     if (virDomainObjIsActive(vm)) {
         if (qemuSecurityGetProcessLabel(driver->securityManager,
-                                        vm->def, vm->pid, seclabel) < 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           "%s", _("Failed to get security label"));
+                                        vm->def, vm->pid, seclabel) < 0)
             goto cleanup;
-        }
     }
 
     ret = 0;
@@ -6173,8 +6170,6 @@ static int qemuDomainGetSecurityLabelList(virDomainPtr dom,
         for (i = 0; i < len; i++) {
             if (qemuSecurityGetProcessLabel(mgrs[i], vm->def, vm->pid,
                                             &(*seclabels)[i]) < 0) {
-                virReportError(VIR_ERR_INTERNAL_ERROR,
-                               "%s", _("Failed to get security label"));
                 VIR_FREE(mgrs);
                 VIR_FREE(*seclabels);
                 goto cleanup;
-- 
2.13.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] security: Don't overwrite error of GetProcessLabel
Posted by Michal Privoznik 6 years, 9 months ago
On 07/20/2017 01:22 AM, Cole Robinson wrote:
> Security impls of this function already raise errors, don't
> overwrite them.
> 
> Signed-off-by: Cole Robinson <crobinso@redhat.com>
> ---
>  src/lxc/lxc_driver.c   | 6 ++----
>  src/qemu/qemu_driver.c | 7 +------
>  2 files changed, 3 insertions(+), 10 deletions(-)

Indeed. ACK.

Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list