]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: hlua: fix missing lock in hlua_filter_delete()
authorAurelien DARRAGON <adarragon@haproxy.com>
Mon, 11 Mar 2024 12:51:03 +0000 (13:51 +0100)
committerAurelien DARRAGON <adarragon@haproxy.com>
Wed, 13 Mar 2024 08:24:46 +0000 (09:24 +0100)
hlua_filter_delete() calls hlua_unref() on the stream hlua stack, but
we should own the lock prior to manipulating the stack.

This should be backported up to 2.6.

src/hlua.c

index 4dfee0ea01911f7f2f166721241767908583fe84..7f1dfed6da47e31b97e46394a8e73b5085f0ab14 100644 (file)
@@ -12037,7 +12037,9 @@ static void hlua_filter_delete(struct stream *s, struct filter *filter)
 {
        struct hlua_flt_ctx *flt_ctx = filter->ctx;
 
+       hlua_lock(s->hlua);
        hlua_unref(s->hlua->T, flt_ctx->ref);
+       hlua_unlock(s->hlua);
        hlua_ctx_destroy(flt_ctx->hlua[0]);
        hlua_ctx_destroy(flt_ctx->hlua[1]);
        pool_free(pool_head_hlua_flt_ctx, flt_ctx);