Skip to content

Commit 4bc328b

Browse files
committed
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()`.
1 parent c8c8b96 commit 4bc328b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

daemons/attrd/attrd_corosync.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,16 @@ attrd_peer_change_cb(enum pcmk__node_update kind, pcmk__node_status_t *peer,
195195
}
196196
} else {
197197
// Remove all attribute values associated with lost nodes
198-
attrd_peer_remove(peer->name, false, "loss");
198+
if (peer->name != NULL) {
199+
attrd_peer_remove(peer->name, false, "loss");
200+
}
199201
gone = true;
200202
}
201203
break;
202204
}
203205

204206
// Remove votes from cluster nodes that leave, in case election in progress
205-
if (gone && !is_remote) {
207+
if (gone && !is_remote && peer->name != NULL) {
206208
attrd_remove_voter(peer);
207209
attrd_remove_peer_protocol_ver(peer->name);
208210
attrd_do_not_expect_from_peer(peer->name);

0 commit comments

Comments
 (0)