BUG/MINOR: ssl: Destroy ckch instances before the store during deinit
authorRemi Tricot-Le Breton <rlebreton@haproxy.com>
Wed, 7 Feb 2024 15:38:44 +0000 (16:38 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 14 Feb 2024 15:26:57 +0000 (16:26 +0100)
commitf3f36ad8f136bebf8185ae54fb92f682a5f4c8cf
treed4a96d313626e010db60bb5bffe8773e7d8b7ff7
parent04b77f84d1b52185fc64735d7d81137479d68b00
BUG/MINOR: ssl: Destroy ckch instances before the store during deinit

The ckch_store's free'ing function might end up calling
'ssl_sock_free_ocsp' if the corresponding certificate had ocsp data.
This ocsp cleanup function expects for the 'refcount_instance' member of
the certificate_ocsp structure to be 0, meaning that no live
ckch instance kept a reference on this certificate_ocsp structure.
But since in ckch_store_free we were destroying the ckch_data before
destroying the linked instances, the BUG_ON would fail during a standard
deinit. Reversing the cleanup order fixes the problem.

Must be backported to 2.8.

(cherry picked from commit a290db5706e76f4cdfd20067a8e73805acddeb65)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
src/ssl_ckch.c