[PATCH] polkit_driver: fix possible segfault

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The changes in commit c7542573 introduced a segfault. Found by coverity.

Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
 src/access/viraccessdriverpolkit.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/access/viraccessdriverpolkit.c b/src/access/viraccessdriverpolkit.c
index 2bc1842..2fd4fed 100644
--- a/src/access/viraccessdriverpolkit.c
+++ b/src/access/viraccessdriverpolkit.c
@@ -87,6 +87,12 @@ virAccessDriverPolkitGetCaller(const char *actionid,
                        actionid);
         return -1;
     }
+    if (!pid) {
+        virAccessError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("No UNIX process ID available"));
+        goto cleanup;
+    }
+
     if (virIdentityGetUNIXProcessID(identity, pid) < 0)
         goto cleanup;
     if (virIdentityGetUNIXProcessTime(identity, startTime) < 0)
@@ -94,12 +100,6 @@ virAccessDriverPolkitGetCaller(const char *actionid,
     if (virIdentityGetUNIXUserID(identity, uid) < 0)
         goto cleanup;
 
-    if (!pid) {
-        virAccessError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("No UNIX process ID available"));
-        goto cleanup;
-    }
-
     if (virIdentityGetUNIXProcessTime(identity, startTime) < 0)
         goto cleanup;
 
-- 
1.8.5.5

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




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]