* [PATCH -next] cifs: Fix to use kmem_cache_free() instead of kfree()
@ 2018-12-18 6:37 Wei Yongjun
2018-12-18 10:57 ` Aurélien Aptel
2018-12-18 15:20 ` Steve French
0 siblings, 2 replies; 3+ messages in thread
From: Wei Yongjun @ 2018-12-18 6:37 UTC (permalink / raw)
To: kernel-janitors
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: Wei Yongjun <weiyongjun1@huawei.com>
---
fs/cifs/dfs_cache.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/cifs/dfs_cache.c b/fs/cifs/dfs_cache.c
index d20cc94..f745677 100644
--- a/fs/cifs/dfs_cache.c
+++ b/fs/cifs/dfs_cache.c
@@ -414,7 +414,7 @@ static int copy_ref_data(const struct dfs_info3_param *refs, int numrefs,
ce->ce_path = kstrdup_const(path, GFP_KERNEL);
if (!ce->ce_path) {
- kfree(ce);
+ kmem_cache_free(dfs_cache_slab, ce);
return ERR_PTR(-ENOMEM);
}
INIT_HLIST_NODE(&ce->ce_hlist);
@@ -423,7 +423,7 @@ static int copy_ref_data(const struct dfs_info3_param *refs, int numrefs,
rc = copy_ref_data(refs, numrefs, ce, NULL);
if (rc) {
kfree(ce->ce_path);
- kfree(ce);
+ kmem_cache_free(dfs_cache_slab, ce);
ce = ERR_PTR(rc);
}
return ce;
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH -next] cifs: Fix to use kmem_cache_free() instead of kfree()
2018-12-18 6:37 [PATCH -next] cifs: Fix to use kmem_cache_free() instead of kfree() Wei Yongjun
@ 2018-12-18 10:57 ` Aurélien Aptel
2018-12-18 15:20 ` Steve French
1 sibling, 0 replies; 3+ messages in thread
From: Aurélien Aptel @ 2018-12-18 10:57 UTC (permalink / raw)
To: kernel-janitors
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
--
Aurélien Aptel / SUSE Labs Samba Team
GPG: 1839 CB5F 9F5B FB9B AA97 8C99 03C8 A49B 521B D5D3
SUSE Linux GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH -next] cifs: Fix to use kmem_cache_free() instead of kfree()
2018-12-18 6:37 [PATCH -next] cifs: Fix to use kmem_cache_free() instead of kfree() Wei Yongjun
2018-12-18 10:57 ` Aurélien Aptel
@ 2018-12-18 15:20 ` Steve French
1 sibling, 0 replies; 3+ messages in thread
From: Steve French @ 2018-12-18 15:20 UTC (permalink / raw)
To: kernel-janitors
merged into cifs-2.6.git for-next
On Tue, Dec 18, 2018 at 12:29 AM Wei Yongjun <weiyongjun1@huawei.com> wrote:
>
> 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: Wei Yongjun <weiyongjun1@huawei.com>
> ---
> fs/cifs/dfs_cache.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/cifs/dfs_cache.c b/fs/cifs/dfs_cache.c
> index d20cc94..f745677 100644
> --- a/fs/cifs/dfs_cache.c
> +++ b/fs/cifs/dfs_cache.c
> @@ -414,7 +414,7 @@ static int copy_ref_data(const struct dfs_info3_param *refs, int numrefs,
>
> ce->ce_path = kstrdup_const(path, GFP_KERNEL);
> if (!ce->ce_path) {
> - kfree(ce);
> + kmem_cache_free(dfs_cache_slab, ce);
> return ERR_PTR(-ENOMEM);
> }
> INIT_HLIST_NODE(&ce->ce_hlist);
> @@ -423,7 +423,7 @@ static int copy_ref_data(const struct dfs_info3_param *refs, int numrefs,
> rc = copy_ref_data(refs, numrefs, ce, NULL);
> if (rc) {
> kfree(ce->ce_path);
> - kfree(ce);
> + kmem_cache_free(dfs_cache_slab, ce);
> ce = ERR_PTR(rc);
> }
> return ce;
>
>
>
--
Thanks,
Steve
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-12-18 15:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-18 6:37 [PATCH -next] cifs: Fix to use kmem_cache_free() instead of kfree() Wei Yongjun
2018-12-18 10:57 ` Aurélien Aptel
2018-12-18 15:20 ` Steve French
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox