]> git.neil.brown.name Git - history.git/commitdiff
[NET]: Do net_todo_list empty check under semaphore.
authorDavid S. Miller <davem@nuts.davemloft.net>
Sat, 29 May 2004 06:10:54 +0000 (23:10 -0700)
committerDavid S. Miller <davem@nuts.davemloft.net>
Sat, 29 May 2004 06:10:54 +0000 (23:10 -0700)
net/core/dev.c

index e77815ed835ead871caf15e5ec45732c03e2ea2e..84384802ce9bf197251f23a51e15d16c0101cfa9 100644 (file)
@@ -2979,15 +2979,18 @@ void netdev_run_todo(void)
        struct list_head list = LIST_HEAD_INIT(list);
        int err;
 
-       /* Safe outside mutex since we only care about entries that
-        * this cpu put into queue while under RTNL.
-        */
-       if (list_empty(&net_todo_list))
-               return;
 
        /* Need to guard against multiple cpu's getting out of order. */
        down(&net_todo_run_mutex);
 
+       /* Not safe to do outside the semaphore.  We must not return
+        * until all unregister events invoked by the local processor
+        * have been completed (either by this todo run, or one on
+        * another cpu).
+        */
+       if (list_empty(&net_todo_list))
+               goto out;
+
        /* Snapshot list, allow later requests */
        spin_lock(&net_todo_list_lock);
        list_splice_init(&net_todo_list, &list);
@@ -3034,6 +3037,7 @@ void netdev_run_todo(void)
                }
        }
 
+out:
        up(&net_todo_run_mutex);
 }