mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 23:56:57 +02:00
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.
This commit is contained in:
parent
9ea5d361ae
commit
db64489aac
@ -226,7 +226,7 @@ struct cond_wordlist {
|
|||||||
do { \
|
do { \
|
||||||
while (1) { \
|
while (1) { \
|
||||||
struct list *n, *n2; \
|
struct list *n, *n2; \
|
||||||
struct list *p, *p2; \
|
struct list *p, *p2 = NULL; \
|
||||||
n = HA_ATOMIC_XCHG(&(el)->n, LLIST_BUSY); \
|
n = HA_ATOMIC_XCHG(&(el)->n, LLIST_BUSY); \
|
||||||
if (n == LLIST_BUSY) \
|
if (n == LLIST_BUSY) \
|
||||||
continue; \
|
continue; \
|
||||||
@ -248,7 +248,8 @@ struct cond_wordlist {
|
|||||||
if (n != (el)) { \
|
if (n != (el)) { \
|
||||||
n2 = HA_ATOMIC_XCHG(&n->p, LLIST_BUSY); \
|
n2 = HA_ATOMIC_XCHG(&n->p, LLIST_BUSY); \
|
||||||
if (n2 == LLIST_BUSY) { \
|
if (n2 == LLIST_BUSY) { \
|
||||||
p2->n = (el); \
|
if (p2 != NULL) \
|
||||||
|
p2->n = (el); \
|
||||||
(el)->p = p; \
|
(el)->p = p; \
|
||||||
(el)->n = n; \
|
(el)->n = n; \
|
||||||
__ha_barrier_store(); \
|
__ha_barrier_store(); \
|
||||||
|
Loading…
Reference in New Issue
Block a user