[haiku-commits] haiku: hrev48669 - src/system/kernel

  • From: anevilyak@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 13 Jan 2015 01:11:51 +0100 (CET)

hrev48669 adds 1 changeset to branch 'master'
old head: 683cf2ff58b85b9224cd8a7e08310c2b1041b952
new head: be60c04c8932758e86a1121605ea340af53e90c0
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=be60c04+%5E683cf2f

----------------------------------------------------------------------------

be60c04: 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.

                                      [ Rene Gollent <anevilyak@xxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev48669
Commit:      be60c04c8932758e86a1121605ea340af53e90c0
URL:         http://cgit.haiku-os.org/haiku/commit/?id=be60c04
Author:      Rene Gollent <anevilyak@xxxxxxxxx>
Date:        Tue Jan 13 00:08:05 2015 UTC

Ticket:      https://dev.haiku-os.org/ticket/11746

----------------------------------------------------------------------------

1 file changed, 4 insertions(+), 3 deletions(-)
src/system/kernel/module.cpp | 7 ++++---

----------------------------------------------------------------------------

diff --git a/src/system/kernel/module.cpp b/src/system/kernel/module.cpp
index 8808640..af601e2 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 {


Other related posts: