BUG/MEDIUM: lists: Avoid an infinite loop in MT_LIST_TRY_ADDQ().
authorOlivier Houchard <cognet@ci0.org>
Thu, 18 Feb 2021 22:55:30 +0000 (23:55 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 22 Feb 2021 09:23:25 +0000 (10:23 +0100)
commit6f682bea6ab08830d17ef3e973be6cc4d2474e69
treef025a8c58cd0e829a3ce08dc394a66eb5d23c883
parent37e078908b2de6c8961085c1f8fd51a289ba0d28
BUG/MEDIUM: lists: Avoid an infinite loop in MT_LIST_TRY_ADDQ().

In MT_LIST_TRY_ADDQ(), deal with the "prev" field of the element before the
"next". If the element is the first in the list, then its next will
already have been locked when we locked list->prev->next, so locking it
again will fail, and we'll start over and over.

This should be backported to 2.3.

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