]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-daemon: Fix a crash due to a failed updateip
authorMartin Schwenke <mschwenke@ddn.com>
Wed, 15 Oct 2025 21:17:44 +0000 (08:17 +1100)
committerJule Anger <janger@samba.org>
Mon, 27 Oct 2025 13:24:10 +0000 (13:24 +0000)
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 <ballison@45drives.com>
Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
(cherry picked from commit d08f9ebd2755671d30c73a4e979029d353848828)

ctdb/server/ctdb_takeover.c

index 60f60e29ffc3f50c71466772a55970317e285e4a..cbf8d0a5b10a71c70b48139408de1658abd9fc8f 100644 (file)
@@ -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);