1 commit 3f0b1de623d09f8668db34c1be696f7245de7d50
2 Author: Christopher Faulet <cfaulet@haproxy.com>
3 Date: Wed Jun 19 10:50:38 2019 +0200
5 BUG/MEDIUM: lb_fwlc: Don't test the server's lb_tree from outside the lock
7 In the function fwlc_srv_reposition(), the server's lb_tree is tested from
8 outside the lock. So it is possible to remove it after the test and then call
9 eb32_insert() in fwlc_queue_srv() with a NULL root pointer, which is
10 invalid. Moving the test in the scope of the lock fixes the bug.
12 This issue was reported on Github, issue #126.
14 This patch must be backported to 2.0, 1.9 and 1.8.
16 (cherry picked from commit 1ae2a8878170ded922f2c4d32b6704af7689bbfd)
17 Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
19 diff --git a/src/lb_fwlc.c b/src/lb_fwlc.c
20 index 174dc67e..5fa81739 100644
23 @@ -66,12 +66,11 @@ static inline void fwlc_queue_srv(struct server *s)
25 static void fwlc_srv_reposition(struct server *s)
30 HA_SPIN_LOCK(LBPRM_LOCK, &s->proxy->lbprm.lock);
31 - fwlc_dequeue_srv(s);
34 + fwlc_dequeue_srv(s);
37 HA_SPIN_UNLOCK(LBPRM_LOCK, &s->proxy->lbprm.lock);