File bsc#1239629-0001-Fix-pacemaker-attrd-prevent-segfault-if-a-peer-leave.patch of Package pacemaker.38495
From eaff3d57a5b4d56146820c1e3e532f23ff35b330 Mon Sep 17 00:00:00 2001
From: "Gao,Yan" <ygao@suse.com>
Date: Tue, 18 Mar 2025 16:57:25 +0100
Subject: [PATCH 1/8] Fix: pacemaker-attrd: prevent segfault if a peer leaves
when its name is unknown yet
If nodes are not configured with names in corosync, when a node joins
the cluster, it takes a while for it to learn the names of all the other
online peers. Previously, if any of the peers happened to leave when its
`name` was unknown to us yet, pacemaker-attrd would trigger assertion in
`attrd_peer_remove()` and segfault in
`attrd_remove_peer_protocol_ver()`.
---
daemons/attrd/attrd_commands.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
Index: pacemaker-2.0.5+20201202.ba59be712/daemons/attrd/attrd_commands.c
===================================================================
--- pacemaker-2.0.5+20201202.ba59be712.orig/daemons/attrd/attrd_commands.c
+++ pacemaker-2.0.5+20201202.ba59be712/daemons/attrd/attrd_commands.c
@@ -975,14 +975,16 @@ attrd_peer_change_cb(enum crm_status_typ
}
} else {
// Remove all attribute values associated with lost nodes
- attrd_peer_remove(peer->uname, FALSE, "loss");
+ if (peer->uname != NULL) {
+ attrd_peer_remove(peer->uname, FALSE, "loss");
+ }
remove_voter = TRUE;
}
break;
}
// In case an election is in progress, remove any vote by the node
- if (remove_voter) {
+ if (remove_voter && peer->uname != NULL) {
attrd_remove_voter(peer);
}
}