]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
cifs: Get rid of kstrdup_const()'d paths
authorPaulo Alcantara (SUSE) <pc@cjr.nz>
Fri, 23 Jun 2023 21:34:03 +0000 (21:34 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 28 Jun 2023 08:18:37 +0000 (10:18 +0200)
commit 199c6bdfb04b71d88a7765e08285885fbca60df4 upstream.

The DFS cache API is mostly used with heap allocated strings.

Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Rishabh Bhatnagar <risbhat@amazon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/cifs/dfs_cache.c

index 4a241979c7c766fa12acb944cab4aa38f46d083d..3ca65051b55ce0186ab8b6a8a94d968c13e4ee59 100644 (file)
@@ -131,7 +131,7 @@ static inline void flush_cache_ent(struct cache_entry *ce)
                return;
 
        hlist_del_init_rcu(&ce->hlist);
-       kfree_const(ce->path);
+       kfree(ce->path);
        free_tgts(ce);
        cache_count--;
        call_rcu(&ce->rcu, free_cache_entry);
@@ -420,7 +420,7 @@ static struct cache_entry *alloc_cache_entry(const char *path,
        if (!ce)
                return ERR_PTR(-ENOMEM);
 
-       ce->path = kstrdup_const(path, GFP_KERNEL);
+       ce->path = kstrndup(path, strlen(path), GFP_KERNEL);
        if (!ce->path) {
                kmem_cache_free(cache_slab, ce);
                return ERR_PTR(-ENOMEM);
@@ -430,7 +430,7 @@ static struct cache_entry *alloc_cache_entry(const char *path,
 
        rc = copy_ref_data(refs, numrefs, ce, NULL);
        if (rc) {
-               kfree_const(ce->path);
+               kfree(ce->path);
                kmem_cache_free(cache_slab, ce);
                ce = ERR_PTR(rc);
        }