]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MAJOR: cache: Crash because of disabled entry not removed from the tree
authorRemi Tricot-Le Breton <rlebreton@haproxy.com>
Tue, 15 Dec 2020 13:30:12 +0000 (14:30 +0100)
committerWilliam Lallemand <wlallemand@haproxy.org>
Tue, 15 Dec 2020 14:31:30 +0000 (15:31 +0100)
commit964caaff0e56ef0b243c77d37da9907c77d90e3e
tree80c9287f2cde071d80a1f9aef41545bc2c165d54
parenta55685bfea0c95fd311b9bd0478950e534305786
BUG/MAJOR: cache: Crash because of disabled entry not removed from the tree

The cache entries are now added into the tree even when they are not
complete yet. If we realized while trying to add a response's payload
that the shctx was full, the entry was disabled through the
disable_cache_entry function, which cleared the key field of the entry's
node, but without actually removing it from the tree. So the shctx row
could be stolen from the entry and the row's content be rewritten while
a lookup in the tree would still find a reference to the old entry. This
caused a random crash in case of cache saturation and row reuse.
This patch adds the missing removal of the node from the tree next to
the reset of the key in disable_cache_entry.

This bug was introduced by commit 3243447 ("MINOR: cache: Add entry
to the tree as soon as possible")

It does not need to be backported.
src/cache.c