]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: queue: fix the tree walk in pendconn_redistribute.
authorWilly Tarreau <w@1wt.eu>
Mon, 27 May 2019 06:10:11 +0000 (08:10 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 27 May 2019 08:29:59 +0000 (10:29 +0200)
commitbff005ae587c8d51deb4a1e916a2b9e42f0c6eb1
treee377b5265655e2b37aa9147d15495a328c6564c0
parentb6195ef2a6b0cb3f68bc34735313daa640ab3e92
BUG/MEDIUM: queue: fix the tree walk in pendconn_redistribute.

In pendconn_redistribute() we scan the queue using eb32_next() on the
node we've just deleted, which is wrong since the node is not in the
tree anymore, and it could dereference one node that has already been
released by another thread. Note that we cannot use eb32_first() in the
loop here instead because we need to skip pendconns having SF_FORCE_PRST.
Instead, let's keep a copy of the next node before deleting it.

In addition, the pendconn retrieved there is wrong, it uses &node as
the pointer instead of node, resulting in very quick crashes when the
server list is scanned.

Fortunately this only happens when "option redispatch" is used in
conjunction with "maxconn" on server lines, "cookie" for the stickiness,
and when a server goes down with entries in its queue.

This bug was introduced by commit 0355dabd7 ("MINOR: queue: replace
the linked list with a tree") so the fix must be backported to 1.9.
src/queue.c