Skip to content

Commit

Permalink
cifs: handle empty list of targets in cifs_reconnect()
Browse files Browse the repository at this point in the history
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@cjr.nz>
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
  • Loading branch information
Paulo Alcantara authored and Steve French committed Aug 2, 2020
1 parent 7d397a0 commit a529303
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions fs/cifs/connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -470,11 +470,13 @@ cifs_reconnect(struct TCP_Server_Info *server)
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);
}
Expand Down

0 comments on commit a529303

Please sign in to comment.