]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: list: fix the rollback on addq in the locked liss
authorWilly Tarreau <w@1wt.eu>
Thu, 28 Feb 2019 10:09:56 +0000 (11:09 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 28 Feb 2019 14:10:15 +0000 (15:10 +0100)
Commit a8434ec14 ("MINOR: lists: Implement locked variations.")
introduced locked lists which use the elements pointers as locks
for concurrent operations. A copy-paste typo in LIST_ADDQ_LOCKED()
causes corruption in the list in case the next pointer is already
held, as it restores the previous pointer into the next one. It
may impact the server pools.

This will have to be backported if the commit above is backported.

include/common/mini-clist.h

index 08228283a3718671c9d94e5531932bd10a6c5d21..53db885b828b7d7ac4121bb709ec5db5b8017c0a 100644 (file)
@@ -208,7 +208,7 @@ struct cond_wordlist {
                        __ha_barrier_store();                              \
                        n = HA_ATOMIC_XCHG(&p->n, LLIST_BUSY);             \
                        if (n == LLIST_BUSY) {                             \
-                               (lh)->n = p;                               \
+                               (lh)->p = p;                               \
                                __ha_barrier_store();                      \
                                continue;                                  \
                        }                                                  \