diff mbox series

dfs_cache: fix a wrong use of kfree in flush_cache_ent()

Message ID 20190528011239.GA12886@zhanggen-UX430UQ
State New
Headers show
Series dfs_cache: fix a wrong use of kfree in flush_cache_ent() | expand

Commit Message

Gen Zhang May 28, 2019, 1:12 a.m. UTC
In flush_cache_ent(), 'ce->ce_path' is allocated by kstrdup_const().
It should be freed by kfree_const(), rather than kfree().

Signed-off-by: Gen Zhang <blackgod016574@gmail.com>
diff mbox series


diff --git a/fs/cifs/dfs_cache.c b/fs/cifs/dfs_cache.c
index 85dc89d..e3e1c13 100644
--- a/fs/cifs/dfs_cache.c
+++ b/fs/cifs/dfs_cache.c
@@ -132,7 +132,7 @@  static inline void flush_cache_ent(struct dfs_cache_entry *ce)
-	kfree(ce->ce_path);
+	kfree_const(ce->ce_path);
 	call_rcu(&ce->ce_rcu, free_cache_entry);
@@ -422,7 +422,7 @@  alloc_cache_entry(const char *path, const struct dfs_info3_param *refs,
 	rc = copy_ref_data(refs, numrefs, ce, NULL);
 	if (rc) {
-		kfree(ce->ce_path);
+		kfree_const(ce->ce_path);
 		kmem_cache_free(dfs_cache_slab, ce);
 		ce = ERR_PTR(rc);