diff options
author | Chengguang Xu <cgxu519@icloud.com> | 2018-03-01 01:24:51 -0500 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2018-03-01 10:39:47 -0500 |
commit | 1c789249578895bb14ab62b4327306439b754857 (patch) | |
tree | 1bb1b07b70d2c31165e57da1a32571f0bce7ccdc /fs | |
parent | 18106734b512664a8541026519ce4b862498b6c3 (diff) |
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>
Diffstat (limited to 'fs')
-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) | |||
713 | goto bad_dentry; | 713 | goto bad_dentry; |
714 | 714 | ||
715 | ceph_file_cachep = KMEM_CACHE(ceph_file_info, SLAB_MEM_SPREAD); | 715 | ceph_file_cachep = KMEM_CACHE(ceph_file_info, SLAB_MEM_SPREAD); |
716 | |||
717 | if (!ceph_file_cachep) | 716 | if (!ceph_file_cachep) |
718 | goto bad_file; | 717 | goto bad_file; |
719 | 718 | ||
720 | if ((error = ceph_fscache_register())) | 719 | error = ceph_fscache_register(); |
721 | goto bad_file; | 720 | if (error) |
721 | goto bad_fscache; | ||
722 | 722 | ||
723 | return 0; | 723 | return 0; |
724 | |||
725 | bad_fscache: | ||
726 | kmem_cache_destroy(ceph_file_cachep); | ||
724 | bad_file: | 727 | bad_file: |
725 | kmem_cache_destroy(ceph_dentry_cachep); | 728 | kmem_cache_destroy(ceph_dentry_cachep); |
726 | bad_dentry: | 729 | bad_dentry: |