From e64b8b13435f99ba21a74caeebeb996f76dfd43c Mon Sep 17 00:00:00 2001 From: Joel Colledge Date: Wed, 26 Jul 2023 10:14:54 +0200 Subject: [PATCH] drbdadm,v9: do not segfault when re-configuring proxy with no path This prevents a segfault when a resource has a connection with no path, and "adjust" attempts to re-configure proxy. This could occur as follows, when drbd-proxy-ctl is not on $PATH: * Bring resource and connection up without proxy. * Add proxy configuration to res file. * "drbdadm adjust " - this causes the existing path to be deleted, but no new path is created because drbd-proxy-ctl cannot be executed. * "drbdadm adjust " - segfault. --- user/v9/drbdadm_adjust.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user/v9/drbdadm_adjust.c b/user/v9/drbdadm_adjust.c index 83df624c4e46..f3d321b9ec65 100644 --- a/user/v9/drbdadm_adjust.c +++ b/user/v9/drbdadm_adjust.c @@ -390,7 +390,7 @@ static int proxy_reconf(const struct cfg_ctx *ctx, struct connection *running_co goto redo_whole_conn; running_path = STAILQ_FIRST(&running_conn->paths); /* multiple paths via proxy, later! */ - if (!running_path->my_proxy) + if (!running_path || !running_path->my_proxy) goto redo_whole_conn; if (running_path->proxy_conn_is_down) -- 2.35.3