]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: connection: fix pool free regression with recent ppv2 TLV patches
authorWilly Tarreau <w@1wt.eu>
Mon, 4 Sep 2023 09:45:37 +0000 (11:45 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 4 Sep 2023 09:45:37 +0000 (11:45 +0200)
In commit fecc573da ("MEDIUM: connection: Generic, list-based allocation
and look-up of PPv2 TLVs") there was a tiny mistake, elements of length
<= 128 are allocated from pool_pp_128 but only those of length < 128 are
released to this pool, other ones go to pool_pp_256. Because of this,
elements of size exactly 128 are allocated from 128 and released to 256.
It can be reproduced a few times by running sample_fetches/tlvs.vtc 1000
times with -DDEBUG_DONT_SHARE_POOLS -DDEBUG_MEMORY_POOLS -DDEBUG_EXPR
-DDEBUG_STRICT=2 -DDEBUG_POOL_INTEGRITY -DDEBUG_POOL_TRACING
-DDEBUG_NO_POOLS. Not sure why it doesn't reproduce more often though.

No backport is needed. This should address github issues #2275 and #2274.

src/connection.c

index 5d84d60374192c51ff82fc16aa62444d6631a25e..5f7226aaeca6ad09f8f8e7831509b45310fd7f2e 100644 (file)
@@ -569,7 +569,7 @@ void conn_free(struct connection *conn)
                LIST_DELETE(&tlv->list);
                if (tlv->len > HA_PP2_TLV_VALUE_256)
                        free(tlv);
-               else if (tlv->len < HA_PP2_TLV_VALUE_128)
+               else if (tlv->len <= HA_PP2_TLV_VALUE_128)
                        pool_free(pool_head_pp_tlv_128, tlv);
                else
                        pool_free(pool_head_pp_tlv_256, tlv);