[PATCH] hugetlbfs: fix error path in module_init

From: Akinobu Mita
Date: Sat Apr 28 2007 - 03:25:50 EST


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

Cc: William Irwin <wli@xxxxxxxxxxxxxx>
Signed-off-by: Akinobu Mita <akinobu.mita@xxxxxxxxx>

---
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;
}

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