From: Christopher Faulet Date: Mon, 18 Mar 2019 12:57:42 +0000 (+0100) Subject: BUG/MAJOR: spoe: Fix initialization of thread-dependent fields X-Git-Tag: v2.0-dev2~47 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fe261551b9980fe33990eb34d2153bf1de24b20f;p=thirdparty%2Fhaproxy.git BUG/MAJOR: spoe: Fix initialization of thread-dependent fields A bug was introduced in the commit b0769b ("BUG/MEDIUM: spoe: initialization depending on nbthread must be done last"). The code depending on global.nbthread was moved from cfg_parse_spoe_agent() to spoe_check() but the pointer on the agent configuration was not updated to use the filter's one. The variable curagent is a global variable only valid during the configuration parsing. In spoe_check(), conf->agent must be used instead. This patch must be backported to 1.9 and 1.8. --- diff --git a/src/flt_spoe.c b/src/flt_spoe.c index 437f025a1b..b82071007c 100644 --- a/src/flt_spoe.c +++ b/src/flt_spoe.c @@ -3082,18 +3082,18 @@ spoe_check(struct proxy *px, struct flt_conf *fconf) if (global.nbthread == 1) conf->agent->flags |= SPOE_FL_ASYNC; - if ((curagent->rt = calloc(global.nbthread, sizeof(*curagent->rt))) == NULL) { + if ((conf->agent->rt = calloc(global.nbthread, sizeof(*conf->agent->rt))) == NULL) { ha_alert("Proxy %s : out of memory initializing SPOE agent '%s' declared at %s:%d.\n", px->id, conf->agent->id, conf->agent->conf.file, conf->agent->conf.line); return 1; } for (i = 0; i < global.nbthread; ++i) { - curagent->rt[i].frame_size = curagent->max_frame_size; - curagent->rt[i].processing = 0; - LIST_INIT(&curagent->rt[i].applets); - LIST_INIT(&curagent->rt[i].sending_queue); - LIST_INIT(&curagent->rt[i].waiting_queue); - HA_SPIN_INIT(&curagent->rt[i].lock); + conf->agent->rt[i].frame_size = conf->agent->max_frame_size; + conf->agent->rt[i].processing = 0; + LIST_INIT(&conf->agent->rt[i].applets); + LIST_INIT(&conf->agent->rt[i].sending_queue); + LIST_INIT(&conf->agent->rt[i].waiting_queue); + HA_SPIN_INIT(&conf->agent->rt[i].lock); } free(conf->agent->b.name);