46 lines
1.4 KiB
Diff
46 lines
1.4 KiB
Diff
From 79b778debfee5b4ab2d099b2bfc7385f45597f70 Mon Sep 17 00:00:00 2001
|
|
From: Klaus Wenninger <klaus.wenninger@aon.at>
|
|
Date: Tue, 26 Mar 2019 11:17:45 +0100
|
|
Subject: [PATCH] Fix: sbd-pacemaker: bail out of status earlier
|
|
|
|
Prevents possible subsequent null-pointer access and avoids
|
|
unnecessary search for node.
|
|
---
|
|
src/sbd-pacemaker.c | 10 +++++++---
|
|
1 file changed, 7 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/src/sbd-pacemaker.c b/src/sbd-pacemaker.c
|
|
index c69fc55..9a8b95f 100644
|
|
--- a/src/sbd-pacemaker.c
|
|
+++ b/src/sbd-pacemaker.c
|
|
@@ -276,7 +276,7 @@ compute_status(pe_working_set_t * data_set)
|
|
static int updates = 0;
|
|
static int ever_had_quorum = FALSE;
|
|
|
|
- node_t *node = pe_find_node(data_set->nodes, local_uname);
|
|
+ node_t *node = NULL;
|
|
|
|
updates++;
|
|
|
|
@@ -286,11 +286,15 @@ compute_status(pe_working_set_t * data_set)
|
|
return;
|
|
}
|
|
|
|
+ node = pe_find_node(data_set->nodes, local_uname);
|
|
|
|
- if (node == NULL) {
|
|
+ if ((node == NULL) || (node->details == NULL)) {
|
|
set_servant_health(pcmk_health_unknown, LOG_WARNING, "Node state: %s is UNKNOWN", local_uname);
|
|
+ notify_parent();
|
|
+ return;
|
|
+ }
|
|
|
|
- } else if (node->details->online == FALSE) {
|
|
+ if (node->details->online == FALSE) {
|
|
set_servant_health(pcmk_health_unknown, LOG_WARNING, "Node state: OFFLINE");
|
|
|
|
} else if (node->details->unclean) {
|
|
--
|
|
1.8.3.1
|
|
|