From: Marcel Lauhoff Date: Fri, 6 Mar 2026 09:44:08 +0000 (+0100) Subject: rgw: KMS Cache: Reset Reaper State in Async+Threaded X-Git-Tag: v21.0.1~14^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e1043721018590b02e2ffd9e4001cf42d024fbe9;p=ceph.git rgw: KMS Cache: Reset Reaper State in Async+Threaded Reset reaper state to monostate in the async and threaded case. Fixes a possible use after free in the async reaper case. Signed-off-by: Marcel Lauhoff On-behalf-of: SAP marcel.lauhoff@sap.com --- diff --git a/src/rgw/rgw_kms_cache.cc b/src/rgw/rgw_kms_cache.cc index c221d8bb25e..334487c33eb 100644 --- a/src/rgw/rgw_kms_cache.cc +++ b/src/rgw/rgw_kms_cache.cc @@ -148,7 +148,7 @@ void KMSCache::stop_ttl_reaper() { ceph_assert(cache); std::visit( fu2::overload( - [](const std::monostate& mono) {}, + [](const std::monostate&) {}, [](AsyncState& async_state) { boost::asio::dispatch( async_state.strand, @@ -161,8 +161,9 @@ void KMSCache::stop_ttl_reaper() { if (e.code() != std::future_errc::no_state) throw; } }, - [&](const std::jthread&) { reaper_state.emplace(); }), + [](const std::jthread&) {}), reaper_state); + reaper_state.emplace(); } void KMSCache::clear_cache() const {