]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: memory: fix freeing logic in pool_gc2()
authorWilly Tarreau <w@1wt.eu>
Mon, 22 Dec 2014 20:40:55 +0000 (21:40 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 23 Dec 2014 10:22:57 +0000 (11:22 +0100)
commit57767b80329ceade67302aed4fd9760ed5f3d644
tree0f631c7912a705288cff648085cfd631b2a9d756
parenta69fc9f803c05de93b03fc7d4a28d5c503c6d3c9
BUG/MEDIUM: memory: fix freeing logic in pool_gc2()

There's a long-standing bug in pool_gc2(). It tries to protect the pool
against releasing of too many entries but the formula is wrong as it
compares allocated to minavail instead of (allocated-used) to minavail.
Under memory contention, it ends up releasing more than what is granted
by minavail and causes trouble to the dynamic buffer allocator.

This bug is in fact major by itself, but since minavail has never been
used till now, there is no impact at least in mainline. A backport to
1.5 is desired anyway in case any future backport or out-of-tree patch
relies on this.
src/memory.c