From: Olivier Houchard Date: Wed, 25 Nov 2026 16:35:16 +0000 (+0100) Subject: BUG/MEDIUM: ssl/cli: reset the transaction on interrupted CA/CRL commits X-Git-Url: https://git.kaiwu.me/web//%22%22?a=commitdiff_plain;h=24e2ea37525d718fece01ae9ff8b68c4d36281de;p=haproxy.git BUG/MEDIUM: ssl/cli: reset the transaction on interrupted CA/CRL commits As was fixed for certificates in commit ca42c37bc ("BUG/MEDIUM: ssl/cli: reset the ongoing transaction when "commit ssl cert" is interrupted"), when a "commit ssl ca-file" or "commit ssl crl-file" applet is released before the end, e.g. because the CLI client left while it was yielding, the release function frees the new entry but the transaction still references it, or the old entry, already freed once the new one is inserted. The next "show", "set", "commit" or "abort" on that file then uses freed memory, which crashes the process. Let's reset the transaction in the release functions when the applet did not reach CACRL_ST_FIN. This was introduced in 2.5 with the commands, by commits a32a68bd3 ("MEDIUM: ssl: Add "set+commit ssl ca-file" CLI commands") and a51b339d9 ("MEDIUM: ssl: Add "set+commit ssl crl-file" CLI commands"), so this should be backported to all stable branches. --- diff --git a/src/ssl_ckch.c b/src/ssl_ckch.c index 2e41acd16..84b3d6fcb 100644 --- a/src/ssl_ckch.c +++ b/src/ssl_ckch.c @@ -4017,6 +4017,13 @@ static void cli_release_commit_cafile(struct appctx *appctx) struct commit_cacrlfile_ctx *ctx = appctx->svcctx; struct cafile_entry *new_cafile_entry = ctx->new_entry; + /* the transaction is over, e.g. if the client left before the end of the commit */ + if (ctx->state != CACRL_ST_FIN) { + cafile_transaction.new_cafile_entry = NULL; + cafile_transaction.old_cafile_entry = NULL; + cafile_transaction.path = NULL; + } + /* Remove the uncommitted cafile_entry from the tree. */ if (new_cafile_entry) { ebmb_delete(&new_cafile_entry->node); @@ -4516,6 +4523,13 @@ static void cli_release_commit_crlfile(struct appctx *appctx) struct commit_cacrlfile_ctx *ctx = appctx->svcctx; struct cafile_entry *new_crlfile_entry = ctx->new_entry; + /* the transaction is over, e.g. if the client left before the end of the commit */ + if (ctx->state != CACRL_ST_FIN) { + crlfile_transaction.new_crlfile_entry = NULL; + crlfile_transaction.old_crlfile_entry = NULL; + crlfile_transaction.path = NULL; + } + /* Remove the uncommitted cafile_entry from the tree. */ if (new_crlfile_entry) { ebmb_delete(&new_crlfile_entry->node);