From c8e7b49172969ed5691fb2f8351bebe6844a5aba Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 14 Feb 2023 09:40:13 -0500 Subject: [PATCH] Make sure that Server init and shutdown happen with the stack lock held. (#25041) --- src/app/server/Server.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/app/server/Server.cpp b/src/app/server/Server.cpp index c41f5c3bb47fb4..c1d6d25414eef7 100644 --- a/src/app/server/Server.cpp +++ b/src/app/server/Server.cpp @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -105,6 +106,7 @@ static ::chip::app::CircularEventBuffer sLoggingBuffer[CHIP_NUM_EVENT_LOGGING_BU CHIP_ERROR Server::Init(const ServerInitParams & initParams) { ChipLogProgress(AppServer, "Server initializing..."); + assertChipStackLockedByCurrentThread(); CASESessionManagerConfig caseSessionManagerConfig; DeviceLayer::DeviceInfoProvider * deviceInfoprovider = nullptr; @@ -461,6 +463,7 @@ void Server::ScheduleFactoryReset() void Server::Shutdown() { + assertChipStackLockedByCurrentThread(); PlatformMgr().RemoveEventHandler(OnPlatformEventWrapper, 0); mCASEServer.Shutdown(); mCASESessionManager.Shutdown();