]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: ssl: free the ckch instance linked to a server
authorWilliam Lallemand <wlallemand@haproxy.org>
Thu, 30 Dec 2021 13:45:19 +0000 (14:45 +0100)
committerWilliam Lallemand <wlallemand@haproxy.org>
Thu, 30 Dec 2021 15:56:52 +0000 (16:56 +0100)
This patch unlinks and frees the ckch instance linked to a server during
the free of this server.

This could have locked certificates in a "Used" state when removing
servers dynamically from the CLI. And could provoke a segfault once we
try to dynamically update the certificate after that.

This must be backported as far as 2.4.

src/ssl_sock.c

index 810560b5273a90dddc9662eedf1dbff0610d1e97..47bbf1da1c192c80027f3d007ac91c2c19ffe588 100644 (file)
@@ -5247,6 +5247,8 @@ void ssl_sock_free_srv_ctx(struct server *srv)
 #ifdef HAVE_SSL_CTX_SET_CIPHERSUITES
        ha_free(&srv->ssl_ctx.ciphersuites);
 #endif
+       /* If there is a certificate we must unlink the ckch instance */
+       ckch_inst_free(srv->ssl_ctx.inst);
 }
 
 /* Walks down the two trees in bind_conf and frees all the certs. The pointer may