public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hugetlbfs: fix error path in module_init
@ 2007-04-28  7:19 Akinobu Mita
  2007-04-28  7:44 ` Alexey Dobriyan
  2007-04-28 14:50 ` William Lee Irwin III
  0 siblings, 2 replies; 8+ messages in thread
From: Akinobu Mita @ 2007-04-28  7:19 UTC (permalink / raw)
  To: linux-kernel; +Cc: William Irwin

init_hugetlbfs_fs() needs to unregister hugetlbfs
when kern_mount() returns error.

Cc: William Irwin <wli@holomorphy.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>

---
 fs/hugetlbfs/inode.c |   22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

Index: 2.6-mm/fs/hugetlbfs/inode.c
===================================================================
--- 2.6-mm.orig/fs/hugetlbfs/inode.c
+++ 2.6-mm/fs/hugetlbfs/inode.c
@@ -804,20 +804,23 @@ static int __init init_hugetlbfs_fs(void
 
 	error = register_filesystem(&hugetlbfs_fs_type);
 	if (error)
-		goto out;
+		goto out_cache;
 
 	vfsmount = kern_mount(&hugetlbfs_fs_type);
 
-	if (!IS_ERR(vfsmount)) {
-		hugetlbfs_vfsmount = vfsmount;
-		return 0;
+	if (IS_ERR(vfsmount)) {
+		error = PTR_ERR(vfsmount);
+		goto out_fs;
 	}
+	hugetlbfs_vfsmount = vfsmount;
 
-	error = PTR_ERR(vfsmount);
+	return 0;
+
+out_fs:
+	unregister_filesystem(&hugetlbfs_fs_type);
+out_cache:
+	kmem_cache_destroy(hugetlbfs_inode_cachep);
 
- out:
-	if (error)
-		kmem_cache_destroy(hugetlbfs_inode_cachep);
 	return error;
 }
 

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-04-28 18:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-28  7:19 [PATCH] hugetlbfs: fix error path in module_init Akinobu Mita
2007-04-28  7:44 ` Alexey Dobriyan
2007-04-28 10:58   ` Akinobu Mita
2007-04-28 14:46   ` William Lee Irwin III
2007-04-28 14:50 ` William Lee Irwin III
2007-04-28 16:18   ` Akinobu Mita
2007-04-28 16:29     ` [PATCH] hugetlbfs: add NULL check in hugetlb_zero_setup() Akinobu Mita
2007-04-28 18:15       ` William Lee Irwin III

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox