Skip to content

Commit a529303

Browse files
Paulo Alcantarasmfrench
authored andcommitted
cifs: handle empty list of targets in cifs_reconnect()
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) <[email protected]> Reviewed-by: Aurelien Aptel <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 7d397a0 commit a529303

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

fs/cifs/connect.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -470,11 +470,13 @@ cifs_reconnect(struct TCP_Server_Info *server)
470470
sb = NULL;
471471
} else {
472472
cifs_sb = CIFS_SB(sb);
473-
474473
rc = reconn_setup_dfs_targets(cifs_sb, &tgt_list);
475-
if (rc && (rc != -EOPNOTSUPP)) {
476-
cifs_server_dbg(VFS, "%s: no target servers for DFS failover\n",
477-
__func__);
474+
if (rc) {
475+
cifs_sb = NULL;
476+
if (rc != -EOPNOTSUPP) {
477+
cifs_server_dbg(VFS, "%s: no target servers for DFS failover\n",
478+
__func__);
479+
}
478480
} else {
479481
server->nr_targets = dfs_cache_get_nr_tgts(&tgt_list);
480482
}

0 commit comments

Comments
 (0)