This is a note to let you know that I've just added the patch titled cifs: Get rid of kstrdup_const()'d paths to the 5.4-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: cifs-get-rid-of-kstrdup_const-d-paths.patch and it can be found in the queue-5.4 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From stable-owner@xxxxxxxxxxxxxxx Fri Jun 23 23:35:44 2023 From: Rishabh Bhatnagar <risbhat@xxxxxxxxxx> Date: Fri, 23 Jun 2023 21:34:03 +0000 Subject: cifs: Get rid of kstrdup_const()'d paths To: <gregkh@xxxxxxxxxxxxxxxxxxx>, <pc@xxxxxx> Cc: <stable@xxxxxxxxxxxxxxx>, <linux-kernel@xxxxxxxxxxxxxxx>, <linux-cifs@xxxxxxxxxxxxxxx>, Aurelien Aptel <aaptel@xxxxxxxx>, Steve French <stfrench@xxxxxxxxxxxxx>, Rishabh Bhatnagar <risbhat@xxxxxxxxxx> Message-ID: <20230623213406.5596-3-risbhat@xxxxxxxxxx> From: "Paulo Alcantara (SUSE)" <pc@xxxxxx> commit 199c6bdfb04b71d88a7765e08285885fbca60df4 upstream. The DFS cache API is mostly used with heap allocated strings. Signed-off-by: Paulo Alcantara (SUSE) <pc@xxxxxx> Reviewed-by: Aurelien Aptel <aaptel@xxxxxxxx> Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx> Signed-off-by: Rishabh Bhatnagar <risbhat@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/cifs/dfs_cache.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/fs/cifs/dfs_cache.c +++ b/fs/cifs/dfs_cache.c @@ -131,7 +131,7 @@ static inline void flush_cache_ent(struc 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_e 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_e 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); } Patches currently in stable-queue which might be from stable-owner@xxxxxxxxxxxxxxx are queue-5.4/cifs-clean-up-dfs-referral-cache.patch queue-5.4/cifs-merge-is_path_valid-into-get_normalized_path.patch queue-5.4/cifs-introduce-helpers-for-finding-tcp-connection.patch queue-5.4/cifs-get-rid-of-kstrdup_const-d-paths.patch queue-5.4/cifs-fix-potential-deadlock-when-updating-vol-in-cifs_reconnect.patch