mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-23 06:41:32 +02:00
BUG/MINOR: map/cli: protect the backref list during "show map" errors
In case of write error in "show map", the backref is detached but the list wasn't locked when this is done. The risk is very low but it may happen that two concurrent "show map" one of which would fail or one "show map" failing while the same entry is being updated could cause a crash. This should be backported to all stable versions.
This commit is contained in:
parent
4f9f157537
commit
2edaace575
@ -332,10 +332,12 @@ static int cli_io_handler_pat_list(struct appctx *appctx)
|
|||||||
* reference to the last ref_elt being dumped.
|
* reference to the last ref_elt being dumped.
|
||||||
*/
|
*/
|
||||||
if (appctx->st2 == STAT_ST_LIST) {
|
if (appctx->st2 == STAT_ST_LIST) {
|
||||||
|
HA_SPIN_LOCK(PATREF_LOCK, &appctx->ctx.map.ref->lock);
|
||||||
if (!LIST_ISEMPTY(&appctx->ctx.map.bref.users)) {
|
if (!LIST_ISEMPTY(&appctx->ctx.map.bref.users)) {
|
||||||
LIST_DELETE(&appctx->ctx.map.bref.users);
|
LIST_DELETE(&appctx->ctx.map.bref.users);
|
||||||
LIST_INIT(&appctx->ctx.map.bref.users);
|
LIST_INIT(&appctx->ctx.map.bref.users);
|
||||||
}
|
}
|
||||||
|
HA_SPIN_UNLOCK(PATREF_LOCK, &appctx->ctx.map.ref->lock);
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user