From: Martin Schwenke Date: Wed, 15 Oct 2025 21:17:44 +0000 (+1100) Subject: ctdb-daemon: Fix a crash due to a failed updateip X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d08f9ebd2755671d30c73a4e979029d353848828;p=thirdparty%2Fsamba.git ctdb-daemon: Fix a crash due to a failed updateip This should really be a takeip. However, CTDB's weak check of the IP address state (using bind(2)) incorrectly indicates that the IP address is assigned to an interface so it is converted to an updateip. After commit 0536d7a98b832fc00d26b09c26bf14fb63dbf5fb (which improves IP address state checking), this will almost certainly not occur on platforms with getifaddrs(3) (e.g. Linux). This means it is only likely to occur in 4.21 when net.ipv4.ip_nonlocal_bind=1. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15935 Reported-by: Bailey Allison Signed-off-by: Martin Schwenke Reviewed-by: Anoop C S --- diff --git a/ctdb/server/ctdb_takeover.c b/ctdb/server/ctdb_takeover.c index 60f60e29ffc..cbf8d0a5b10 100644 --- a/ctdb/server/ctdb_takeover.c +++ b/ctdb/server/ctdb_takeover.c @@ -617,7 +617,15 @@ static void ctdb_do_updateip_callback(struct ctdb_context *ctdb, int status, */ ctdb_vnn_unassign_iface(ctdb, state->vnn); state->vnn->iface = state->old; - state->vnn->iface->references++; + /* + * state->old (above) can be NULL if the IP wasn't + * recorded as held by this node but the system thinks + * the IP was assigned. In that case, a move could + * still be desirable.. + */ + if (state->vnn->iface != NULL) { + state->vnn->iface->references++; + } ctdb_request_control_reply(ctdb, state->c, NULL, status, NULL); talloc_free(state);