diff mbox series

[4/4] cifs: use DFS root session instead of tcon ses

Message ID 20230314233256.16468-4-pc.crab@mail.manguebit.com (mailing list archive)
State New, archived
Headers show
Series [1/4] cifs: set DFS root session in cifs_get_smb_ses() | expand

Commit Message

Paulo Alcantara March 14, 2023, 11:32 p.m. UTC
Use DFS root session whenever possible to get new DFS referrals
otherwise we might end up with an IPC tcon (tcon->ses->tcon_ipc) that
doesn't respond to them.  It should be safe accessing
@ses->dfs_root_ses directly in cifs_inval_name_dfs_link_error() as it
has same lifetime as of @tcon.

Signed-off-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
---
 fs/cifs/misc.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c
index 6f9c78650528..b44fb51968bf 100644
--- a/fs/cifs/misc.c
+++ b/fs/cifs/misc.c
@@ -1262,6 +1262,7 @@  int cifs_inval_name_dfs_link_error(const unsigned int xid,
 		 * removing cached DFS targets that the client would eventually
 		 * need during failover.
 		 */
+		ses = CIFS_DFS_ROOT_SES(ses);
 		if (ses->server->ops->get_dfs_refer &&
 		    !ses->server->ops->get_dfs_refer(xid, ses, ref_path, &refs,
 						     &num_refs, cifs_sb->local_nls,