Commit 9f33cf76 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] copy_namespace ENOMEM fix

From: Marcus Alanen <maalanen@ra.abo.fi>

The copy_tree() function can return NULL, so this checks for it.
parent 89076ac4
......@@ -817,12 +817,16 @@ int copy_namespace(int flags, struct task_struct *tsk)
atomic_set(&new_ns->count, 1);
init_rwsem(&new_ns->sem);
new_ns->root = NULL;
INIT_LIST_HEAD(&new_ns->list);
down_write(&tsk->namespace->sem);
/* First pass: copy the tree topology */
new_ns->root = copy_tree(namespace->root, namespace->root->mnt_root);
if (!new_ns->root) {
up_write(&tsk->namespace->sem);
kfree(new_ns);
goto out;
}
spin_lock(&vfsmount_lock);
list_add_tail(&new_ns->list, &new_ns->root->mnt_list);
spin_unlock(&vfsmount_lock);
......
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