diff options
| author | Paulo Alcantara <pc@manguebit.com> | 2024-12-06 11:49:07 -0300 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-12-14 20:03:19 +0100 |
| commit | 0d8658c0cb599a5a2de809f88e335072c38d463d (patch) | |
| tree | ab1e15a03b3c6744b96eeb3f48201dc4ec2ac408 /fs/smb | |
| parent | 0e421cb8085cc50264759e37baacd4b8b827ccbc (diff) | |
| download | linux-0d8658c0cb599a5a2de809f88e335072c38d463d.tar.gz linux-0d8658c0cb599a5a2de809f88e335072c38d463d.tar.bz2 linux-0d8658c0cb599a5a2de809f88e335072c38d463d.zip | |
smb: client: fix potential race in cifs_put_tcon()
[ Upstream commit c32b624fa4f7ca5a2ff217a0b1b2f1352bb4ec11 ]
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: 4f42a8b54b5c ("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: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs/smb')
| -rw-r--r-- | fs/smb/client/connect.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c index a94c538ff863..feff3324d39c 100644 --- a/fs/smb/client/connect.c +++ b/fs/smb/client/connect.c @@ -2512,9 +2512,6 @@ cifs_put_tcon(struct cifs_tcon *tcon, enum smb3_tcon_ref_trace trace) list_del_init(&tcon->tcon_list); tcon->status = TID_EXITING; -#ifdef CONFIG_CIFS_DFS_UPCALL - list_replace_init(&tcon->dfs_ses_list, &ses_list); -#endif spin_unlock(&tcon->tc_lock); spin_unlock(&cifs_tcp_ses_lock); @@ -2522,6 +2519,7 @@ cifs_put_tcon(struct cifs_tcon *tcon, enum smb3_tcon_ref_trace trace) cancel_delayed_work_sync(&tcon->query_interfaces); #ifdef CONFIG_CIFS_DFS_UPCALL cancel_delayed_work_sync(&tcon->dfs_cache_work); + list_replace_init(&tcon->dfs_ses_list, &ses_list); #endif if (tcon->use_witness) { |
