diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2006-09-29 05:01:04 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-29 12:18:20 -0400 |
commit | a4376e13ce07774be14e83fe501ef5c8500b83a1 (patch) | |
tree | 2f56903af62a7ab5820e069aeab1813f45469b6b /fs/freevxfs/vxfs_super.c | |
parent | 50d44ed009a628e6d5c784fae18ea743d7cf199a (diff) |
[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/freevxfs/vxfs_super.c')
-rw-r--r-- | fs/freevxfs/vxfs_super.c | 11 |
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 = { | |||
260 | static int __init | 260 | static int __init |
261 | vxfs_init(void) | 261 | vxfs_init(void) |
262 | { | 262 | { |
263 | int rv; | ||
264 | |||
263 | vxfs_inode_cachep = kmem_cache_create("vxfs_inode", | 265 | vxfs_inode_cachep = kmem_cache_create("vxfs_inode", |
264 | sizeof(struct vxfs_inode_info), 0, | 266 | sizeof(struct vxfs_inode_info), 0, |
265 | SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD, NULL, NULL); | 267 | SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD, NULL, NULL); |
266 | if (vxfs_inode_cachep) | 268 | if (!vxfs_inode_cachep) |
267 | return register_filesystem(&vxfs_fs_type); | 269 | return -ENOMEM; |
268 | return -ENOMEM; | 270 | rv = register_filesystem(&vxfs_fs_type); |
271 | if (rv < 0) | ||
272 | kmem_cache_destroy(vxfs_inode_cachep); | ||
273 | return rv; | ||
269 | } | 274 | } |
270 | 275 | ||
271 | static void __exit | 276 | static void __exit |