mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-03-18 21:14:28 +00:00
[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>
This commit is contained in:
parent
50d44ed009
commit
a4376e13ce
1 changed files with 8 additions and 3 deletions
|
@ -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
|
||||||
|
|
Loading…
Add table
Reference in a new issue