From be60c04c8932758e86a1121605ea340af53e90c0 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Mon, 12 Jan 2015 19:08:05 -0500 Subject: [PATCH] modules: Fix #11746. - When normalizing paths of the preloaded modules to their final mounted path, remove them from the hash table before updating their path. Otherwise, the remove would fail due to the hash no longer matching, which in turn would cause the code in question to introduce an infinite loop in the hash table's internal link list due to manually rewriting the next link. --- src/system/kernel/module.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/system/kernel/module.cpp b/src/system/kernel/module.cpp index 8808640eea..af601e2d56 100644 --- a/src/system/kernel/module.cpp +++ b/src/system/kernel/module.cpp @@ -1910,15 +1910,16 @@ module_init_post_boot_device(bool bootingFromBootLoaderVolume) TRACE((" normalized path of module image %p, \"%s\" -> " "\"%s\"\n", image, image->path, pathBuffer.Path())); + // remove the image -- its hash value has probably changed, + // so we need to re-insert it later + sModuleImagesHash->RemoveUnchecked(image); + // set the new path free(image->path); size_t pathLen = pathBuffer.Length(); image->path = (char*)realloc(pathBuffer.DetachBuffer(), pathLen + 1); - // remove the image -- its hash value has probably changed, - // so we need to re-insert it later - sModuleImagesHash->RemoveUnchecked(image); image->next = imagesToReinsert; imagesToReinsert = image; } else {