Skip to content

Commit d3927e5

Browse files
Paulo Alcantaragregkh
authored andcommitted
smb: client: fix potential race in cifs_put_tcon()
commit c32b624 upstream. 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) <pc@manguebit.com> Signed-off-by: Steve French <stfrench@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent a4bb7ce commit d3927e5

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

fs/smb/client/connect.c

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

25582558
list_del_init(&tcon->tcon_list);
25592559
tcon->status = TID_EXITING;
2560-
#ifdef CONFIG_CIFS_DFS_UPCALL
2561-
list_replace_init(&tcon->dfs_ses_list, &ses_list);
2562-
#endif
25632560
spin_unlock(&tcon->tc_lock);
25642561
spin_unlock(&cifs_tcp_ses_lock);
25652562

25662563
/* cancel polling of interfaces */
25672564
cancel_delayed_work_sync(&tcon->query_interfaces);
25682565
#ifdef CONFIG_CIFS_DFS_UPCALL
25692566
cancel_delayed_work_sync(&tcon->dfs_cache_work);
2567+
list_replace_init(&tcon->dfs_ses_list, &ses_list);
25702568
#endif
25712569

25722570
if (tcon->use_witness) {

0 commit comments

Comments
 (0)