From: Marcus Alanen The copy_tree() function can return NULL, so this checks for it. --- 25-akpm/fs/namespace.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletion(-) diff -puN fs/namespace.c~copy_namespace-enomem-fix fs/namespace.c --- 25/fs/namespace.c~copy_namespace-enomem-fix Mon Jan 26 13:26:25 2004 +++ 25-akpm/fs/namespace.c Mon Jan 26 13:26:25 2004 @@ -825,12 +825,16 @@ int copy_namespace(int flags, struct tas 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); _