BUG/MEDIUM: lists: Lock the element while we check if it is in a list.
authorOlivier Houchard <cognet@ci0.org>
Wed, 25 Nov 2020 19:38:00 +0000 (20:38 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 30 Nov 2020 17:17:29 +0000 (18:17 +0100)
commit1f05324cbe92a7dde71f44dc740eb8240539746f
treebe1b9f5aff5fb2feab17a4c5ae14c678af676d65
parent8a069eb9a4b34e48ea41ac0e270cd2ccbd6fe3e8
BUG/MEDIUM: lists: Lock the element while we check if it is in a list.

In MT_LIST_TRY_ADDQ() and MT_LIST_TRY_ADD() we can't just check if the
element is already in a list, because there's a small race condition, it
could be added  between the time we checked, and the time we actually set
its next and prev, so we have to lock it first.

This is required to address issue #958.

This should be backported to 2.3, 2.2 and 2.1.
include/haproxy/list.h