This is a note to let you know that I've just added the patch titled cifs: handle empty list of targets in cifs_reconnect() 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-handle-empty-list-of-targets-in-cifs_reconnect.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 a52930353eaf443489a350a135c5525a4acbbf56 Mon Sep 17 00:00:00 2001 From: Paulo Alcantara <pc@xxxxxx> Date: Tue, 21 Jul 2020 09:36:41 -0300 Subject: cifs: handle empty list of targets in cifs_reconnect() From: Paulo Alcantara <pc@xxxxxx> commit a52930353eaf443489a350a135c5525a4acbbf56 upstream. In case there were no cached DFS referrals in reconn_setup_dfs_targets(), set cifs_sb to NULL prior to calling reconn_set_next_dfs_target() so it would not try to access an empty tgt_list. 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/connect.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -513,11 +513,13 @@ cifs_reconnect(struct TCP_Server_Info *s sb = NULL; } else { cifs_sb = CIFS_SB(sb); - rc = reconn_setup_dfs_targets(cifs_sb, &tgt_list); - if (rc && (rc != -EOPNOTSUPP)) { - cifs_server_dbg(VFS, "%s: no target servers for DFS failover\n", - __func__); + if (rc) { + cifs_sb = NULL; + if (rc != -EOPNOTSUPP) { + cifs_server_dbg(VFS, "%s: no target servers for DFS failover\n", + __func__); + } } else { server->nr_targets = dfs_cache_get_nr_tgts(&tgt_list); } Patches currently in stable-queue which might be from pc@xxxxxx are queue-5.4/cifs-get-rid-of-unused-parameter-in-reconn_setup_dfs_targets.patch queue-5.4/cifs-handle-empty-list-of-targets-in-cifs_reconnect.patch