BUG/MEDIUM: queue: fix unsafe proxy pointer when counting nbpend
authorWilly Tarreau <w@1wt.eu>
Sat, 24 Oct 2020 10:57:41 +0000 (12:57 +0200)
committerWilly Tarreau <w@1wt.eu>
Sat, 24 Oct 2020 10:57:41 +0000 (12:57 +0200)
commit5472aa50f190d56f1e632df92064ff6fed416f48
tree66119b321a19e9f6ba27385f29d2ce0dbbfbbcf0
parente2370307bee0098bc9bbca51788322f3f3dc4dbc
BUG/MEDIUM: queue: fix unsafe proxy pointer when counting nbpend

As reported by Coverity in issue #917, commit 96bca33 ("OPTIM: queue:
decrement the nbpend and totpend counters outside of the lock")
introduced a bug when moving the increments outside of the loop,
because we can't always rely on the pendconn "p" here as it may
be null. We can retrieve the proxy pointer directly from s->proxy
instead. The same is true for pendconn_redistribute(), though the
last "p" pointer there was still valid. This patch fixes both.

No backport is needed, this was introduced just before 2.3-dev8.
src/queue.c