CONF_modules_unload should fail if CONF_modules_finish fails
authorMatt Caswell <matt@openssl.org>
Thu, 2 Jun 2022 12:54:45 +0000 (13:54 +0100)
committerTomas Mraz <tomas@openssl.org>
Mon, 6 Jun 2022 06:53:38 +0000 (08:53 +0200)
commit697d0b5ba146c232f5b2aa87f4e847a5495c1735
treef6782bdce79a385114ff431de7a6f1d231ca054a
parent1a01e5c29dfaf09af3960b4c8e6ec0f8171eda80
CONF_modules_unload should fail if CONF_modules_finish fails

The module_list_lock is used by CONF_modules_unload(). That function relies
on the RUN_ONCE in CONF_modules_finish() to initialise that lock. However
if the RUN_ONCE fails that failure is not propagated to
CONF_modules_unload() and so it erroneously tries to use the lock anyway.

Found due to:
https://github.com/openssl/openssl/pull/18355#issuecomment-1144734604

Reviewed-by: Todd Short <todd.short@me.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18460)
crypto/conf/conf_mod.c