提交 a4376e13 编写于 作者: A Alexey Dobriyan 提交者: Linus Torvalds

[PATCH] freevxfs: fix leak on error path

If register_filesystem() fails, vxfs_inode cache must be destroyed.
Signed-off-by: NAlexey Dobriyan <adobriyan@gmail.com>
Acked-by: NChristoph Hellwig <hch@lst.de>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 50d44ed0
...@@ -260,12 +260,17 @@ static struct file_system_type vxfs_fs_type = { ...@@ -260,12 +260,17 @@ static struct file_system_type vxfs_fs_type = {
static int __init static int __init
vxfs_init(void) vxfs_init(void)
{ {
int rv;
vxfs_inode_cachep = kmem_cache_create("vxfs_inode", vxfs_inode_cachep = kmem_cache_create("vxfs_inode",
sizeof(struct vxfs_inode_info), 0, sizeof(struct vxfs_inode_info), 0,
SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD, NULL, NULL); SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD, NULL, NULL);
if (vxfs_inode_cachep) if (!vxfs_inode_cachep)
return register_filesystem(&vxfs_fs_type); return -ENOMEM;
return -ENOMEM; rv = register_filesystem(&vxfs_fs_type);
if (rv < 0)
kmem_cache_destroy(vxfs_inode_cachep);
return rv;
} }
static void __exit static void __exit
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册