summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2006-09-29 11:01:04 +0200
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-29 18:18:20 +0200
commita4376e13ce07774be14e83fe501ef5c8500b83a1 (patch)
tree2f56903af62a7ab5820e069aeab1813f45469b6b /fs
parent[PATCH] cramfs: rewrite init_cramfs_fs() (diff)
downloadlinux-a4376e13ce07774be14e83fe501ef5c8500b83a1.tar.xz
linux-a4376e13ce07774be14e83fe501ef5c8500b83a1.zip
[PATCH] freevxfs: fix leak on error path
If register_filesystem() fails, vxfs_inode cache must be destroyed. Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/freevxfs/vxfs_super.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/freevxfs/vxfs_super.c b/fs/freevxfs/vxfs_super.c
index b74b791fc23b..ac28b0835ffc 100644
--- a/fs/freevxfs/vxfs_super.c
+++ b/fs/freevxfs/vxfs_super.c
@@ -260,12 +260,17 @@ static struct file_system_type vxfs_fs_type = {
static int __init
vxfs_init(void)
{
+ int rv;
+
vxfs_inode_cachep = kmem_cache_create("vxfs_inode",
sizeof(struct vxfs_inode_info), 0,
SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD, NULL, NULL);
- if (vxfs_inode_cachep)
- return register_filesystem(&vxfs_fs_type);
- return -ENOMEM;
+ if (!vxfs_inode_cachep)
+ return -ENOMEM;
+ rv = register_filesystem(&vxfs_fs_type);
+ if (rv < 0)
+ kmem_cache_destroy(vxfs_inode_cachep);
+ return rv;
}
static void __exit