From 058d57ef0352ee0f46fc5e0ebe76479660bfc44e Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 29 Jun 2017 10:39:27 -0700 Subject: Protect device enumeration in the router with a mutex --- router/router.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'router/router.c') diff --git a/router/router.c b/router/router.c index 86189b78..4dfae314 100644 --- a/router/router.c +++ b/router/router.c @@ -15,6 +15,8 @@ DriverIface *DriverList = NULL; int DriverListSize = 0; static int DriverListSizeMax = 0; +almtx_t EnumerationLock; + static void LoadDriverList(void); @@ -26,6 +28,7 @@ BOOL APIENTRY DllMain(HINSTANCE UNUSED(module), DWORD reason, void* UNUSED(reser { case DLL_PROCESS_ATTACH: LoadDriverList(); + almtx_init(&EnumerationLock, almtx_recursive); break; case DLL_THREAD_ATTACH: @@ -34,6 +37,7 @@ BOOL APIENTRY DllMain(HINSTANCE UNUSED(module), DWORD reason, void* UNUSED(reser case DLL_PROCESS_DETACH: ReleaseALC(); + almtx_destroy(&EnumerationLock); for(i = 0;i < DriverListSize;i++) { if(DriverList[i].Module) -- cgit v1.2.3