From: Casey Bodley Date: Fri, 20 Aug 2021 14:39:34 +0000 (-0400) Subject: radosgw-admin: bucket sync status guards against shard count mismatch X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=6491e8fb703bd1b1e9f541276ba7be6e0a4d53e9;p=ceph.git radosgw-admin: bucket sync status guards against shard count mismatch if the remote gives us more shards than we expect, just count those shards as 'behind' and avoid out-of-bounds access of shard_status Signed-off-by: Casey Bodley --- diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 7e4c31e9d2ab4..4994f67d143d7 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -2576,12 +2576,17 @@ static int bucket_source_sync_status(const DoutPrefixProvider *dpp, rgw::sal::Ra } std::set shards_behind; - for (auto& r : remote_markers.get()) { + for (const auto& r : remote_markers.get()) { auto shard_id = r.first; - auto& m = shard_status[shard_id]; if (r.second.empty()) { continue; // empty bucket index shard } + if (shard_id >= total_shards) { + // unexpected shard id. we don't have status for it, so we're behind + shards_behind.insert(shard_id); + continue; + } + auto& m = shard_status[shard_id]; const auto pos = BucketIndexShardsManager::get_shard_marker(m.inc_marker.position); if (pos < r.second) { shards_behind.insert(shard_id);