Wineserver crash in inotify code

Alexandre Julliard julliard at winehq.org
Wed Feb 27 07:19:47 CST 2008


"Dan Kegel" <dank at kegel.com> writes:

> http://bugs.winehq.org/show_bug.cgi?id=11746
> may explain a few mysterious wineserver crashes
> I saw a few weeks ago.
>
> Anyone feel like diving in to this one?  It's probably
> a rat's nest of twisty linked lists, and a node isn't
> getting removed properly from all the lists
> it's in when it's freed, or something.

Please give this a try:

diff --git a/server/change.c b/server/change.c
index 590a1cb..2266621 100644
--- a/server/change.c
+++ b/server/change.c
@@ -438,6 +438,7 @@ static void inode_set_name( struct inode *inode, const char *name )
 static void free_inode( struct inode *inode )
 {
     int subtree = 0, watches = 0;
+    struct inode *tmp, *next;
     struct dir *dir;
 
     LIST_FOR_EACH_ENTRY( dir, &inode->dirs, struct dir, in_entry )
@@ -448,7 +449,6 @@ static void free_inode( struct inode *inode )
 
     if (!subtree && !inode->parent)
     {
-        struct inode *tmp, *next;
         LIST_FOR_EACH_ENTRY_SAFE( tmp, next, &inode->children,
                                   struct inode, ch_entry )
         {
@@ -464,6 +464,13 @@ static void free_inode( struct inode *inode )
     if (inode->parent)
         list_remove( &inode->ch_entry );
 
+    /* disconnect remaining children from the parent */
+    LIST_FOR_EACH_ENTRY_SAFE( tmp, next, &inode->children, struct inode, ch_entry )
+    {
+        list_remove( &tmp->ch_entry );
+        tmp->parent = NULL;
+    }
+
     if (inode->wd != -1)
     {
         inotify_remove_watch( get_unix_fd( inotify_fd ), inode->wd );

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list