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.
This commit is contained in:
Rene Gollent 2015-01-12 19:08:05 -05:00
parent 683cf2ff58
commit be60c04c89

View File

@ -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 {