[PATCH] add allocation failure check to copy_namespace()

From: Miklos Szeredi
Date: Fri Feb 13 2004 - 04:46:47 EST


Hi!

The following patch adds a missing allocation failure check to
copy_namespace() in fs/namespace.c

Miklos

--- namespace.c~ 2003-12-18 03:59:05.000000000 +0100
+++ namespace.c 2004-02-13 10:32:42.000000000 +0100
@@ -820,6 +820,8 @@
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)
+ goto out_sem;
spin_lock(&vfsmount_lock);
list_add_tail(&new_ns->list, &new_ns->root->mnt_list);
spin_unlock(&vfsmount_lock);
@@ -863,6 +865,8 @@
put_namespace(namespace);
return 0;

+out_sem:
+ up_write(&tsk->namespace->sem);
out:
put_namespace(namespace);
return -ENOMEM;

-
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/