Skip to content

Commit 0d8658c

Browse files
Paulo Alcantaragregkh
authored andcommitted
smb: client: fix potential race in cifs_put_tcon()
[ Upstream commit c32b624 ] dfs_cache_refresh() delayed worker could race with cifs_put_tcon(), so make sure to call list_replace_init() on @tcon->dfs_ses_list after kworker is cancelled or finished. Fixes: 4f42a8b ("smb: client: fix DFS interlink failover") Signed-off-by: Paulo Alcantara (Red Hat) <[email protected]> Signed-off-by: Steve French <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 0e421cb commit 0d8658c

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

fs/smb/client/connect.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2512,16 +2512,14 @@ cifs_put_tcon(struct cifs_tcon *tcon, enum smb3_tcon_ref_trace trace)
25122512

25132513
list_del_init(&tcon->tcon_list);
25142514
tcon->status = TID_EXITING;
2515-
#ifdef CONFIG_CIFS_DFS_UPCALL
2516-
list_replace_init(&tcon->dfs_ses_list, &ses_list);
2517-
#endif
25182515
spin_unlock(&tcon->tc_lock);
25192516
spin_unlock(&cifs_tcp_ses_lock);
25202517

25212518
/* cancel polling of interfaces */
25222519
cancel_delayed_work_sync(&tcon->query_interfaces);
25232520
#ifdef CONFIG_CIFS_DFS_UPCALL
25242521
cancel_delayed_work_sync(&tcon->dfs_cache_work);
2522+
list_replace_init(&tcon->dfs_ses_list, &ses_list);
25252523
#endif
25262524

25272525
if (tcon->use_witness) {

0 commit comments

Comments
 (0)