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)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 14 Dec 2020 08:15:29 +0000 (09:15 +0100)
commitc4f3013d9452707d4efbda455360c8d2af022411
tree575a87d47c30e8a8ec2fc690f2a49da745ff82f2
parent367c1dbed1e3c5493c22e974fa01cef0f5238ebc
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.

(cherry picked from commit 1f05324cbe92a7dde71f44dc740eb8240539746f)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
include/haproxy/list.h