Re: [PATCH] add allocation failure check to copy_namespace()

From: Miklos Szeredi
Date: Fri Feb 13 2004 - 05:11:42 EST


The previous patch was missing a kfree. So here it goes again:

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

Miklos

--- fs/namespace.c.orig 2003-12-18 03:59:05.000000000 +0100
+++ fs/namespace.c 2004-02-13 11:04:39.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,9 @@
put_namespace(namespace);
return 0;

+out_sem:
+ up_write(&tsk->namespace->sem);
+ kfree(new_ns);
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/