summaryrefslogtreecommitdiff
path: root/fs/cifs
diff options
context:
space:
mode:
authorPaulo Alcantara <palcantara@suse.de>2018-11-20 14:37:18 -0200
committerSteve French <stfrench@microsoft.com>2018-12-28 10:13:11 -0600
commit23324407143dd923660378fd9b40b9a711972269 (patch)
treeb32787ae094f49520eaeef321f66d4c43479adac /fs/cifs
parente511d31753e3f7c13bbd402399ffac676d451a7c (diff)
cifs: Only free DFS target list if we actually got one
Fix potential NULL ptr deref when DFS target list is empty. Signed-off-by: Paulo Alcantara <palcantara@suse.de> Reviewed-by: Aurelien Aptel <aaptel@suse.com> Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/connect.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index ec2498f6773e..80ef165d5f33 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -452,8 +452,8 @@ cifs_reconnect(struct TCP_Server_Info *server)
struct mid_q_entry *mid_entry;
struct list_head retry_list;
#ifdef CONFIG_CIFS_DFS_UPCALL
- struct cifs_sb_info *cifs_sb;
- struct dfs_cache_tgt_list tgt_list;
+ struct cifs_sb_info *cifs_sb = NULL;
+ struct dfs_cache_tgt_list tgt_list = {0};
struct dfs_cache_tgt_iterator *tgt_it = NULL;
#endif
@@ -592,8 +592,8 @@ cifs_reconnect(struct TCP_Server_Info *server)
cifs_dbg(VFS, "%s: failed to update vol info in DFS cache: rc = %d\n",
__func__, rc);
}
+ dfs_cache_free_tgts(&tgt_list);
}
- dfs_cache_free_tgts(&tgt_list);
#endif
if (server->tcpStatus == CifsNeedNegotiate)
mod_delayed_work(cifsiod_wq, &server->echo, 0);