mac80211: Do not report false error from mesh_path_add.
[linux-2.6-block.git] / net / mac80211 / mesh_pathtbl.c
index 7097ef981991fdff901125a527366aa8760153aa..947b13b40726ba5b865a876faa0eac1ed653a719 100644 (file)
@@ -206,7 +206,7 @@ int mesh_path_add(u8 *dst, struct net_device *dev)
                newtbl = mesh_table_grow(mesh_paths);
                if (!newtbl) {
                        write_unlock(&pathtbl_resize_lock);
-                       return -ENOMEM;
+                       return 0;
                }
                rcu_assign_pointer(mesh_paths, newtbl);
                write_unlock(&pathtbl_resize_lock);
@@ -458,25 +458,28 @@ static void mesh_path_node_free(struct hlist_node *p, bool free_leafs)
        struct mpath_node *node = hlist_entry(p, struct mpath_node, list);
        mpath = node->mpath;
        hlist_del_rcu(p);
-       synchronize_rcu();
        if (free_leafs)
                kfree(mpath);
        kfree(node);
 }
 
-static void mesh_path_node_copy(struct hlist_node *p, struct mesh_table *newtbl)
+static int mesh_path_node_copy(struct hlist_node *p, struct mesh_table *newtbl)
 {
        struct mesh_path *mpath;
        struct mpath_node *node, *new_node;
        u32 hash_idx;
 
+       new_node = kmalloc(sizeof(struct mpath_node), GFP_ATOMIC);
+       if (new_node == NULL)
+               return -ENOMEM;
+
        node = hlist_entry(p, struct mpath_node, list);
        mpath = node->mpath;
-       new_node = kmalloc(sizeof(struct mpath_node), GFP_KERNEL);
        new_node->mpath = mpath;
        hash_idx = mesh_table_hash(mpath->dst, mpath->dev, newtbl);
        hlist_add_head(&new_node->list,
                        &newtbl->hash_buckets[hash_idx]);
+       return 0;
 }
 
 int mesh_pathtbl_init(void)