1
0
Fork 0

ceph: fix potential memory leak in init_caches()

[ Upstream commit 1c78924957 ]

There is lack of cache destroy operation for ceph_file_cachep
when failing from fscache register.

Signed-off-by: Chengguang Xu <cgxu519@icloud.com>
Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
pull/10/head
Chengguang Xu 2018-03-01 14:24:51 +08:00 committed by Greg Kroah-Hartman
parent 010f5ccbf4
commit 07d3fb191b
1 changed files with 6 additions and 3 deletions

View File

@ -712,14 +712,17 @@ static int __init init_caches(void)
goto bad_dentry;
ceph_file_cachep = KMEM_CACHE(ceph_file_info, SLAB_MEM_SPREAD);
if (!ceph_file_cachep)
goto bad_file;
if ((error = ceph_fscache_register()))
goto bad_file;
error = ceph_fscache_register();
if (error)
goto bad_fscache;
return 0;
bad_fscache:
kmem_cache_destroy(ceph_file_cachep);
bad_file:
kmem_cache_destroy(ceph_dentry_cachep);
bad_dentry: