lkml.org 
[lkml]   [2004]   [Feb]   [13]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
DateFri, 13 Feb 2004 10:45:18 +0100 (MET)
FromMiklos Szeredi <>
Subject[PATCH] add allocation failure check to copy_namespace()
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@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:00    [from the cache]
©2003-2008