diff options
author | Chengguang Xu <cgxu519@icloud.com> | 2018-03-01 14:24:51 +0800 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2018-03-01 16:39:47 +0100 |
commit | 1c789249578895bb14ab62b4327306439b754857 (patch) | |
tree | 1bb1b07b70d2c31165e57da1a32571f0bce7ccdc | |
parent | 18106734b512664a8541026519ce4b862498b6c3 (diff) | |
download | linux-1c789249578895bb14ab62b4327306439b754857.tar.bz2 |
ceph: fix potential memory leak in init_caches()
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>
-rw-r--r-- | fs/ceph/super.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/ceph/super.c b/fs/ceph/super.c index 1c470b453a9e..fb2bc9c15a23 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c @@ -713,14 +713,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: |