You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

37 lines
1.7 KiB

commit 982bf2a0481648a0885b100cc565add399762028
Author: Olivier Houchard <ohouchard@haproxy.com>
Date: Tue Feb 26 18:46:07 2019 +0100
BUG/MEDIUM: lists: Properly handle the case we're removing the first elt.
In LIST_DEL_LOCKED(), initialize p2 to NULL, and only attempt to set it back
to its previous value if we had a previous element, and thus p2 is non-NULL.
(cherry picked from commit db64489aac2135c6ceceec47fe98dc42c0558466)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit a3d6a2b9dac9775c55a10ed6b60deca219f06ff6)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/include/common/mini-clist.h b/include/common/mini-clist.h
index b3f396ef..aebeec38 100644
--- a/include/common/mini-clist.h
+++ b/include/common/mini-clist.h
@@ -226,7 +226,7 @@ struct cond_wordlist {
do { \
while (1) { \
struct list *n, *n2; \
- struct list *p, *p2; \
+ struct list *p, *p2 = NULL; \
n = HA_ATOMIC_XCHG(&(el)->n, LLIST_BUSY); \
if (n == LLIST_BUSY) \
continue; \
@@ -248,7 +248,8 @@ struct cond_wordlist {
if (n != (el)) { \
n2 = HA_ATOMIC_XCHG(&n->p, LLIST_BUSY); \
if (n2 == LLIST_BUSY) { \
- p2->n = (el); \
+ if (p2 != NULL) \
+ p2->n = (el); \
(el)->p = p; \
(el)->n = n; \
__ha_barrier_store(); \