Commit 3e80be01 authored by Wei Yongjun's avatar Wei Yongjun Committed by Steve French

cifs: Fix to use kmem_cache_free() instead of kfree()

memory allocated by kmem_cache_alloc() in alloc_cache_entry()
should be freed using kmem_cache_free(), not kfree().

Fixes: 34a44fb160f9 ("cifs: Add DFS cache routines")
Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
Reviewed-by: default avatarAurelien Aptel <aaptel@suse.com>
parent 54e4f73c
...@@ -413,7 +413,7 @@ alloc_cache_entry(const char *path, const struct dfs_info3_param *refs, ...@@ -413,7 +413,7 @@ alloc_cache_entry(const char *path, const struct dfs_info3_param *refs,
ce->ce_path = kstrdup_const(path, GFP_KERNEL); ce->ce_path = kstrdup_const(path, GFP_KERNEL);
if (!ce->ce_path) { if (!ce->ce_path) {
kfree(ce); kmem_cache_free(dfs_cache_slab, ce);
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
} }
INIT_HLIST_NODE(&ce->ce_hlist); INIT_HLIST_NODE(&ce->ce_hlist);
...@@ -422,7 +422,7 @@ alloc_cache_entry(const char *path, const struct dfs_info3_param *refs, ...@@ -422,7 +422,7 @@ alloc_cache_entry(const char *path, const struct dfs_info3_param *refs,
rc = copy_ref_data(refs, numrefs, ce, NULL); rc = copy_ref_data(refs, numrefs, ce, NULL);
if (rc) { if (rc) {
kfree(ce->ce_path); kfree(ce->ce_path);
kfree(ce); kmem_cache_free(dfs_cache_slab, ce);
ce = ERR_PTR(rc); ce = ERR_PTR(rc);
} }
return ce; return ce;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment