[patch] copy_namespace check for NULL
From: Marcus Alanen
Date: Mon Jan 26 2004 - 14:49:11 EST
Hello Andrew,
As far as I can see the copy_tree() function can return NULL, so this
checks for it. Same thing in 2.4, I'll rediff for Marcelo.
Marcus
#
# create_patch: fix_copy_namespace-2004-01-26-A.patch
# Date: Mon Jan 26 21:22:51 EET 2004
#
diff -Naurd --exclude-from=/home/msa/linux/base/diff_exclude linus-2.6.2-rc1-mm2/fs/namespace.c fix_copy_namespace-2.6.2-rc1-mm2/fs/namespace.c
--- linus-2.6.2-rc1-mm2/fs/namespace.c 2004-01-26 19:15:05.000000000 +0000
+++ fix_copy_namespace-2.6.2-rc1-mm2/fs/namespace.c 2004-01-26 19:17:06.000000000 +0000
@@ -822,12 +822,16 @@
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);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/