Commit 0eb03d5a authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by John W. Linville

Fix not checked kmalloc() result.

The new_node kmallocation is not checked for success, so add
this check.

BTW, it also happens under the read_lock.
Signed-off-by: default avatarPavel Emelyanov <xemul@openvz.org>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent f84e71a9
...@@ -164,13 +164,19 @@ int mesh_path_add(u8 *dst, struct net_device *dev) ...@@ -164,13 +164,19 @@ int mesh_path_add(u8 *dst, struct net_device *dev)
err = -ENOMEM; err = -ENOMEM;
goto endadd2; goto endadd2;
} }
new_node = kmalloc(sizeof(struct mpath_node), GFP_KERNEL);
if (!new_node) {
kfree(new_mpath);
atomic_dec(&sdata->u.sta.mpaths);
err = -ENOMEM;
goto endadd2;
}
read_lock(&pathtbl_resize_lock); read_lock(&pathtbl_resize_lock);
memcpy(new_mpath->dst, dst, ETH_ALEN); memcpy(new_mpath->dst, dst, ETH_ALEN);
new_mpath->dev = dev; new_mpath->dev = dev;
new_mpath->flags = 0; new_mpath->flags = 0;
skb_queue_head_init(&new_mpath->frame_queue); skb_queue_head_init(&new_mpath->frame_queue);
new_node = kmalloc(sizeof(struct mpath_node), GFP_KERNEL);
new_node->mpath = new_mpath; new_node->mpath = new_mpath;
new_mpath->timer.data = (unsigned long) new_mpath; new_mpath->timer.data = (unsigned long) new_mpath;
new_mpath->timer.function = mesh_path_timer; new_mpath->timer.function = mesh_path_timer;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment