Skip to content

Commit 2332440

Browse files
Paulo Alcantarasmfrench
authored andcommitted
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>
1 parent e511d31 commit 2332440

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

fs/cifs/connect.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -452,8 +452,8 @@ cifs_reconnect(struct TCP_Server_Info *server)
452452
struct mid_q_entry *mid_entry;
453453
struct list_head retry_list;
454454
#ifdef CONFIG_CIFS_DFS_UPCALL
455-
struct cifs_sb_info *cifs_sb;
456-
struct dfs_cache_tgt_list tgt_list;
455+
struct cifs_sb_info *cifs_sb = NULL;
456+
struct dfs_cache_tgt_list tgt_list = {0};
457457
struct dfs_cache_tgt_iterator *tgt_it = NULL;
458458
#endif
459459

@@ -592,8 +592,8 @@ cifs_reconnect(struct TCP_Server_Info *server)
592592
cifs_dbg(VFS, "%s: failed to update vol info in DFS cache: rc = %d\n",
593593
__func__, rc);
594594
}
595+
dfs_cache_free_tgts(&tgt_list);
595596
}
596-
dfs_cache_free_tgts(&tgt_list);
597597
#endif
598598
if (server->tcpStatus == CifsNeedNegotiate)
599599
mod_delayed_work(cifsiod_wq, &server->echo, 0);

0 commit comments

Comments
 (0)