Skip to content

Commit

Permalink
cifs: Only free DFS target list if we actually got one
Browse files Browse the repository at this point in the history
Fix potential NULL ptr deref when DFS target list is empty.

Signed-off-by: Paulo Alcantara <[email protected]>
Reviewed-by: Aurelien Aptel <[email protected]>
Signed-off-by: Steve French <[email protected]>
  • Loading branch information
Paulo Alcantara authored and Steve French committed Dec 28, 2018
1 parent e511d31 commit 2332440
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fs/cifs/connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 2332440

Please sign in to comment.