Skip to content

Commit c32b624

Browse files
Paulo AlcantaraSteve French
authored andcommitted
smb: client: fix potential race in cifs_put_tcon()
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]>
1 parent ddca502 commit c32b624

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
@@ -2532,16 +2532,14 @@ cifs_put_tcon(struct cifs_tcon *tcon, enum smb3_tcon_ref_trace trace)
25322532

25332533
list_del_init(&tcon->tcon_list);
25342534
tcon->status = TID_EXITING;
2535-
#ifdef CONFIG_CIFS_DFS_UPCALL
2536-
list_replace_init(&tcon->dfs_ses_list, &ses_list);
2537-
#endif
25382535
spin_unlock(&tcon->tc_lock);
25392536
spin_unlock(&cifs_tcp_ses_lock);
25402537

25412538
/* cancel polling of interfaces */
25422539
cancel_delayed_work_sync(&tcon->query_interfaces);
25432540
#ifdef CONFIG_CIFS_DFS_UPCALL
25442541
cancel_delayed_work_sync(&tcon->dfs_cache_work);
2542+
list_replace_init(&tcon->dfs_ses_list, &ses_list);
25452543
#endif
25462544

25472545
if (tcon->use_witness) {

0 commit comments

Comments
 (0)