summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenrik Edin <henrik.edin@mongodb.com>2021-06-01 11:01:20 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-06-01 23:00:36 +0000
commit2da60c28f0996433e61e80ac5cfdde621244837e (patch)
treee19047e010ec55fe645cfc5d4fca1ad6de6064fd
parent77bc0c7b73b6810fe97c3a7c10255b25ebe69027 (diff)
downloadmongo-2da60c28f0996433e61e80ac5cfdde621244837e.tar.gz
SERVER-57324 dropDatabase should not modify CollectionCatalog inplace
It causes listCollection to use-after-free as it reads from a stashed CollectionCatalog that is supposed to be immutable.
-rw-r--r--src/mongo/db/storage/storage_engine_impl.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mongo/db/storage/storage_engine_impl.cpp b/src/mongo/db/storage/storage_engine_impl.cpp
index da8cbe327db..ddebc8519fd 100644
--- a/src/mongo/db/storage/storage_engine_impl.cpp
+++ b/src/mongo/db/storage/storage_engine_impl.cpp
@@ -805,7 +805,7 @@ Status StorageEngineImpl::_dropCollectionsNoTimestamp(OperationContext* opCtx,
auto collectionCatalog = CollectionCatalog::get(opCtx);
for (auto& uuid : toDrop) {
auto coll = collectionCatalog->lookupCollectionByUUIDForMetadataWrite(
- opCtx, CollectionCatalog::LifetimeMode::kInplace, uuid);
+ opCtx, CollectionCatalog::LifetimeMode::kManagedInWriteUnitOfWork, uuid);
// No need to remove the indexes from the IndexCatalog because eliminating the Collection
// will have the same effect.