Blob Blame History Raw
From 3ad7b2509d78f95b5dfc8fffc4d9a91be1da5113 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= <jpokorny@redhat.com>
Date: Wed, 17 Apr 2019 15:04:21 +0200
Subject: [PATCH] Med: controld: fix possible NULL pointer dereference

This is now more likely triggerable once the problems related to
CVE-2018-16878 are avoided.
---
 daemons/controld/controld_control.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/daemons/controld/controld_control.c b/daemons/controld/controld_control.c
index ee956982b..0ac358cbe 100644
--- a/daemons/controld/controld_control.c
+++ b/daemons/controld/controld_control.c
@@ -77,12 +77,15 @@ do_ha_control(long long action,
             registered = crm_connect_corosync(cluster);
 #endif
         }
-        controld_election_init(cluster->uname);
-        fsa_our_uname = cluster->uname;
-        fsa_our_uuid = cluster->uuid;
-        if(cluster->uuid == NULL) {
-            crm_err("Could not obtain local uuid");
-            registered = FALSE;
+
+        if (registered == TRUE) {
+            controld_election_init(cluster->uname);
+            fsa_our_uname = cluster->uname;
+            fsa_our_uuid = cluster->uuid;
+            if(cluster->uuid == NULL) {
+                crm_err("Could not obtain local uuid");
+                registered = FALSE;
+            }
         }
 
         if (registered == FALSE) {
-- 
2.21.0