From: Aurelien DARRAGON Date: Mon, 11 Mar 2024 12:50:41 +0000 (+0100) Subject: BUG/MINOR: hlua: missing lock in hlua_filter_new() X-Git-Tag: v3.0-dev6~100 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ecd8f3bfd72ace0af8bc91eb8ec7cf6dc2d6a68c;p=thirdparty%2Fhaproxy.git BUG/MINOR: hlua: missing lock in hlua_filter_new() This is a complementary patch to 8670db7 ("BUG/MAJOR: hlua: improper lock usage with hlua_ctx_resume()") for hlua_filter_new(). Indeed, the HLUA_E_ERRMSG case still relies on the lua stack but didn't take the lock to do so. This should be backported up to 2.6. --- diff --git a/src/hlua.c b/src/hlua.c index 9578923be9..4dfee0ea01 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -11989,7 +11989,9 @@ static int hlua_filter_new(struct stream *s, struct filter *filter) filter->ctx = flt_ctx; break; case HLUA_E_ERRMSG: + hlua_lock(s->hlua); SEND_ERR(s->be, "Lua filter '%s' : %s.\n", conf->reg->name, hlua_tostring_safe(s->hlua->T, -1)); + hlua_unlock(s->hlua); ret = -1; goto end; case HLUA_E_ETMOUT: