patches.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	patches@lists.linux.dev,
	"Paulo Alcantara (Red Hat)" <pc@manguebit.com>,
	Steve French <stfrench@microsoft.com>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH 6.6 076/109] smb: client: fix DFS interlink failover
Date: Tue, 15 Jul 2025 15:13:32 +0200	[thread overview]
Message-ID: <20250715130801.927312731@linuxfoundation.org> (raw)
In-Reply-To: <20250715130758.864940641@linuxfoundation.org>

6.6-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Paulo Alcantara <pc@manguebit.com>

[ Upstream commit 4f42a8b54b5c6e36519aef3cb1f6210e54abd451 ]

The DFS interlinks point to different DFS namespaces so make sure to
use the correct DFS root server to chase any DFS links under it by
storing the SMB session in dfs_ref_walk structure and then using it on
every referral walk.

Signed-off-by: Paulo Alcantara (Red Hat) <pc@manguebit.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Stable-dep-of: 74ebd02163fd ("cifs: all initializations for tcon should happen in tcon_info_alloc")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/smb/client/cifsglob.h   |  3 ++
 fs/smb/client/cifsproto.h  | 12 ++-----
 fs/smb/client/connect.c    | 41 +++++++++++----------
 fs/smb/client/dfs.c        | 73 ++++++++++++++++++--------------------
 fs/smb/client/dfs.h        | 42 ++++++++++++++--------
 fs/smb/client/dfs_cache.c  |  3 +-
 fs/smb/client/fs_context.h |  1 +
 fs/smb/client/misc.c       |  3 ++
 fs/smb/client/namespace.c  |  2 +-
 9 files changed, 94 insertions(+), 86 deletions(-)

diff --git a/fs/smb/client/cifsglob.h b/fs/smb/client/cifsglob.h
index 5c856adf7be9e..c9b37f2ebde85 100644
--- a/fs/smb/client/cifsglob.h
+++ b/fs/smb/client/cifsglob.h
@@ -830,6 +830,7 @@ struct TCP_Server_Info {
 	 * format: \\HOST\SHARE[\OPTIONAL PATH]
 	 */
 	char *leaf_fullpath;
+	bool dfs_conn:1;
 };
 
 static inline bool is_smb1(struct TCP_Server_Info *server)
@@ -1065,6 +1066,7 @@ struct cifs_ses {
 	struct list_head smb_ses_list;
 	struct list_head rlist; /* reconnect list */
 	struct list_head tcon_list;
+	struct list_head dlist; /* dfs list */
 	struct cifs_tcon *tcon_ipc;
 	spinlock_t ses_lock;  /* protect anything here that is not protected */
 	struct mutex session_mutex;
@@ -1294,6 +1296,7 @@ struct cifs_tcon {
 	/* BB add field for back pointer to sb struct(s)? */
 #ifdef CONFIG_CIFS_DFS_UPCALL
 	struct delayed_work dfs_cache_work;
+	struct list_head dfs_ses_list;
 #endif
 	struct delayed_work	query_interfaces; /* query interfaces workqueue job */
 	char *origin_fullpath; /* canonical copy of smb3_fs_context::source */
diff --git a/fs/smb/client/cifsproto.h b/fs/smb/client/cifsproto.h
index c6d325666b5cd..8edb6fe89a97c 100644
--- a/fs/smb/client/cifsproto.h
+++ b/fs/smb/client/cifsproto.h
@@ -737,15 +737,9 @@ static inline int cifs_create_options(struct cifs_sb_info *cifs_sb, int options)
 
 int cifs_wait_for_server_reconnect(struct TCP_Server_Info *server, bool retry);
 
-/* Put references of @ses and its children */
 static inline void cifs_put_smb_ses(struct cifs_ses *ses)
 {
-	struct cifs_ses *next;
-
-	do {
-		next = ses->dfs_root_ses;
-		__cifs_put_smb_ses(ses);
-	} while ((ses = next));
+	__cifs_put_smb_ses(ses);
 }
 
 /* Get an active reference of @ses and its children.
@@ -759,9 +753,7 @@ static inline void cifs_put_smb_ses(struct cifs_ses *ses)
 static inline void cifs_smb_ses_inc_refcount(struct cifs_ses *ses)
 {
 	lockdep_assert_held(&cifs_tcp_ses_lock);
-
-	for (; ses; ses = ses->dfs_root_ses)
-		ses->ses_count++;
+	ses->ses_count++;
 }
 
 static inline bool dfs_src_pathname_equal(const char *s1, const char *s2)
diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c
index 8298d1745f9b9..14be8822d23a2 100644
--- a/fs/smb/client/connect.c
+++ b/fs/smb/client/connect.c
@@ -1551,6 +1551,9 @@ static int match_server(struct TCP_Server_Info *server,
 	if (server->nosharesock)
 		return 0;
 
+	if (!match_super && (ctx->dfs_conn || server->dfs_conn))
+		return 0;
+
 	/* If multidialect negotiation see if existing sessions match one */
 	if (strcmp(ctx->vals->version_string, SMB3ANY_VERSION_STRING) == 0) {
 		if (server->vals->protocol_id < SMB30_PROT_ID)
@@ -1740,6 +1743,7 @@ cifs_get_tcp_session(struct smb3_fs_context *ctx,
 
 	if (ctx->nosharesock)
 		tcp_ses->nosharesock = true;
+	tcp_ses->dfs_conn = ctx->dfs_conn;
 
 	tcp_ses->ops = ctx->ops;
 	tcp_ses->vals = ctx->vals;
@@ -1890,12 +1894,14 @@ cifs_get_tcp_session(struct smb3_fs_context *ctx,
 }
 
 /* this function must be called with ses_lock and chan_lock held */
-static int match_session(struct cifs_ses *ses, struct smb3_fs_context *ctx)
+static int match_session(struct cifs_ses *ses,
+			 struct smb3_fs_context *ctx,
+			 bool match_super)
 {
 	struct TCP_Server_Info *server = ses->server;
 	enum securityEnum ctx_sec, ses_sec;
 
-	if (ctx->dfs_root_ses != ses->dfs_root_ses)
+	if (!match_super && ctx->dfs_root_ses != ses->dfs_root_ses)
 		return 0;
 
 	/*
@@ -2047,7 +2053,7 @@ cifs_find_smb_ses(struct TCP_Server_Info *server, struct smb3_fs_context *ctx)
 			continue;
 		}
 		spin_lock(&ses->chan_lock);
-		if (match_session(ses, ctx)) {
+		if (match_session(ses, ctx, false)) {
 			spin_unlock(&ses->chan_lock);
 			spin_unlock(&ses->ses_lock);
 			ret = ses;
@@ -2450,8 +2456,6 @@ cifs_get_smb_ses(struct TCP_Server_Info *server, struct smb3_fs_context *ctx)
 	 * need to lock before changing something in the session.
 	 */
 	spin_lock(&cifs_tcp_ses_lock);
-	if (ctx->dfs_root_ses)
-		cifs_smb_ses_inc_refcount(ctx->dfs_root_ses);
 	ses->dfs_root_ses = ctx->dfs_root_ses;
 	list_add(&ses->smb_ses_list, &server->smb_ses_list);
 	spin_unlock(&cifs_tcp_ses_lock);
@@ -2528,6 +2532,7 @@ cifs_put_tcon(struct cifs_tcon *tcon, enum smb3_tcon_ref_trace trace)
 {
 	unsigned int xid;
 	struct cifs_ses *ses;
+	LIST_HEAD(ses_list);
 
 	/*
 	 * IPC tcon share the lifetime of their session and are
@@ -2552,6 +2557,9 @@ 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);
 
@@ -2579,6 +2587,9 @@ cifs_put_tcon(struct cifs_tcon *tcon, enum smb3_tcon_ref_trace trace)
 	cifs_fscache_release_super_cookie(tcon);
 	tconInfoFree(tcon, netfs_trace_tcon_ref_free);
 	cifs_put_smb_ses(ses);
+#ifdef CONFIG_CIFS_DFS_UPCALL
+	dfs_put_root_smb_sessions(&ses_list);
+#endif
 }
 
 /**
@@ -2962,7 +2973,7 @@ cifs_match_super(struct super_block *sb, void *data)
 	spin_lock(&ses->chan_lock);
 	spin_lock(&tcon->tc_lock);
 	if (!match_server(tcp_srv, ctx, true) ||
-	    !match_session(ses, ctx) ||
+	    !match_session(ses, ctx, true) ||
 	    !match_tcon(tcon, ctx) ||
 	    !match_prepath(sb, tcon, mnt_data)) {
 		rc = 0;
@@ -3712,13 +3723,12 @@ int cifs_is_path_remote(struct cifs_mount_ctx *mnt_ctx)
 int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb3_fs_context *ctx)
 {
 	struct cifs_mount_ctx mnt_ctx = { .cifs_sb = cifs_sb, .fs_ctx = ctx, };
-	bool isdfs;
 	int rc;
 
-	rc = dfs_mount_share(&mnt_ctx, &isdfs);
+	rc = dfs_mount_share(&mnt_ctx);
 	if (rc)
 		goto error;
-	if (!isdfs)
+	if (!ctx->dfs_conn)
 		goto out;
 
 	/*
@@ -4135,7 +4145,7 @@ cifs_set_vol_auth(struct smb3_fs_context *ctx, struct cifs_ses *ses)
 }
 
 static struct cifs_tcon *
-__cifs_construct_tcon(struct cifs_sb_info *cifs_sb, kuid_t fsuid)
+cifs_construct_tcon(struct cifs_sb_info *cifs_sb, kuid_t fsuid)
 {
 	int rc;
 	struct cifs_tcon *master_tcon = cifs_sb_master_tcon(cifs_sb);
@@ -4233,17 +4243,6 @@ __cifs_construct_tcon(struct cifs_sb_info *cifs_sb, kuid_t fsuid)
 	return tcon;
 }
 
-static struct cifs_tcon *
-cifs_construct_tcon(struct cifs_sb_info *cifs_sb, kuid_t fsuid)
-{
-	struct cifs_tcon *ret;
-
-	cifs_mount_lock();
-	ret = __cifs_construct_tcon(cifs_sb, fsuid);
-	cifs_mount_unlock();
-	return ret;
-}
-
 struct cifs_tcon *
 cifs_sb_master_tcon(struct cifs_sb_info *cifs_sb)
 {
diff --git a/fs/smb/client/dfs.c b/fs/smb/client/dfs.c
index bd259b04cdede..c35953843373e 100644
--- a/fs/smb/client/dfs.c
+++ b/fs/smb/client/dfs.c
@@ -69,7 +69,7 @@ static int get_session(struct cifs_mount_ctx *mnt_ctx, const char *full_path)
  * Get an active reference of @ses so that next call to cifs_put_tcon() won't
  * release it as any new DFS referrals must go through its IPC tcon.
  */
-static void add_root_smb_session(struct cifs_mount_ctx *mnt_ctx)
+static void set_root_smb_session(struct cifs_mount_ctx *mnt_ctx)
 {
 	struct smb3_fs_context *ctx = mnt_ctx->fs_ctx;
 	struct cifs_ses *ses = mnt_ctx->ses;
@@ -95,7 +95,7 @@ static inline int parse_dfs_target(struct smb3_fs_context *ctx,
 	return rc;
 }
 
-static int set_ref_paths(struct cifs_mount_ctx *mnt_ctx,
+static int setup_dfs_ref(struct cifs_mount_ctx *mnt_ctx,
 			 struct dfs_info3_param *tgt,
 			 struct dfs_ref_walk *rw)
 {
@@ -120,6 +120,7 @@ static int set_ref_paths(struct cifs_mount_ctx *mnt_ctx,
 	}
 	ref_walk_path(rw) = ref_path;
 	ref_walk_fpath(rw) = full_path;
+	ref_walk_ses(rw) = ctx->dfs_root_ses;
 	return 0;
 }
 
@@ -128,11 +129,11 @@ static int __dfs_referral_walk(struct cifs_mount_ctx *mnt_ctx,
 {
 	struct smb3_fs_context *ctx = mnt_ctx->fs_ctx;
 	struct dfs_info3_param tgt = {};
-	bool is_refsrv;
 	int rc = -ENOENT;
 
 again:
 	do {
+		ctx->dfs_root_ses = ref_walk_ses(rw);
 		if (ref_walk_empty(rw)) {
 			rc = dfs_get_referral(mnt_ctx, ref_walk_path(rw) + 1,
 					      NULL, ref_walk_tl(rw));
@@ -158,10 +159,7 @@ static int __dfs_referral_walk(struct cifs_mount_ctx *mnt_ctx,
 			if (rc)
 				continue;
 
-			is_refsrv = tgt.server_type == DFS_TYPE_ROOT ||
-				DFS_INTERLINK(tgt.flags);
 			ref_walk_set_tgt_hint(rw);
-
 			if (tgt.flags & DFSREF_STORAGE_SERVER) {
 				rc = cifs_mount_get_tcon(mnt_ctx);
 				if (!rc)
@@ -172,12 +170,10 @@ static int __dfs_referral_walk(struct cifs_mount_ctx *mnt_ctx,
 					continue;
 			}
 
-			if (is_refsrv)
-				add_root_smb_session(mnt_ctx);
-
+			set_root_smb_session(mnt_ctx);
 			rc = ref_walk_advance(rw);
 			if (!rc) {
-				rc = set_ref_paths(mnt_ctx, &tgt, rw);
+				rc = setup_dfs_ref(mnt_ctx, &tgt, rw);
 				if (!rc) {
 					rc = -EREMOTE;
 					goto again;
@@ -193,20 +189,22 @@ static int __dfs_referral_walk(struct cifs_mount_ctx *mnt_ctx,
 	return rc;
 }
 
-static int dfs_referral_walk(struct cifs_mount_ctx *mnt_ctx)
+static int dfs_referral_walk(struct cifs_mount_ctx *mnt_ctx,
+			     struct dfs_ref_walk **rw)
 {
-	struct dfs_ref_walk *rw;
 	int rc;
 
-	rw = ref_walk_alloc();
-	if (IS_ERR(rw))
-		return PTR_ERR(rw);
+	*rw = ref_walk_alloc();
+	if (IS_ERR(*rw)) {
+		rc = PTR_ERR(*rw);
+		*rw = NULL;
+		return rc;
+	}
 
-	ref_walk_init(rw);
-	rc = set_ref_paths(mnt_ctx, NULL, rw);
+	ref_walk_init(*rw);
+	rc = setup_dfs_ref(mnt_ctx, NULL, *rw);
 	if (!rc)
-		rc = __dfs_referral_walk(mnt_ctx, rw);
-	ref_walk_free(rw);
+		rc = __dfs_referral_walk(mnt_ctx, *rw);
 	return rc;
 }
 
@@ -214,16 +212,16 @@ static int __dfs_mount_share(struct cifs_mount_ctx *mnt_ctx)
 {
 	struct cifs_sb_info *cifs_sb = mnt_ctx->cifs_sb;
 	struct smb3_fs_context *ctx = mnt_ctx->fs_ctx;
+	struct dfs_ref_walk *rw = NULL;
 	struct cifs_tcon *tcon;
 	char *origin_fullpath;
-	bool new_tcon = true;
 	int rc;
 
 	origin_fullpath = dfs_get_path(cifs_sb, ctx->source);
 	if (IS_ERR(origin_fullpath))
 		return PTR_ERR(origin_fullpath);
 
-	rc = dfs_referral_walk(mnt_ctx);
+	rc = dfs_referral_walk(mnt_ctx, &rw);
 	if (!rc) {
 		/*
 		 * Prevent superblock from being created with any missing
@@ -241,21 +239,16 @@ static int __dfs_mount_share(struct cifs_mount_ctx *mnt_ctx)
 
 	tcon = mnt_ctx->tcon;
 	spin_lock(&tcon->tc_lock);
-	if (!tcon->origin_fullpath) {
-		tcon->origin_fullpath = origin_fullpath;
-		origin_fullpath = NULL;
-	} else {
-		new_tcon = false;
-	}
+	tcon->origin_fullpath = origin_fullpath;
+	origin_fullpath = NULL;
+	ref_walk_set_tcon(rw, tcon);
 	spin_unlock(&tcon->tc_lock);
-
-	if (new_tcon) {
-		queue_delayed_work(dfscache_wq, &tcon->dfs_cache_work,
-				   dfs_cache_get_ttl() * HZ);
-	}
+	queue_delayed_work(dfscache_wq, &tcon->dfs_cache_work,
+			   dfs_cache_get_ttl() * HZ);
 
 out:
 	kfree(origin_fullpath);
+	ref_walk_free(rw);
 	return rc;
 }
 
@@ -279,7 +272,7 @@ static int update_fs_context_dstaddr(struct smb3_fs_context *ctx)
 	return rc;
 }
 
-int dfs_mount_share(struct cifs_mount_ctx *mnt_ctx, bool *isdfs)
+int dfs_mount_share(struct cifs_mount_ctx *mnt_ctx)
 {
 	struct smb3_fs_context *ctx = mnt_ctx->fs_ctx;
 	bool nodfs = ctx->nodfs;
@@ -289,7 +282,6 @@ int dfs_mount_share(struct cifs_mount_ctx *mnt_ctx, bool *isdfs)
 	if (rc)
 		return rc;
 
-	*isdfs = false;
 	rc = get_session(mnt_ctx, NULL);
 	if (rc)
 		return rc;
@@ -317,10 +309,15 @@ int dfs_mount_share(struct cifs_mount_ctx *mnt_ctx, bool *isdfs)
 		return rc;
 	}
 
-	*isdfs = true;
-	add_root_smb_session(mnt_ctx);
-	rc = __dfs_mount_share(mnt_ctx);
-	dfs_put_root_smb_sessions(mnt_ctx);
+	if (!ctx->dfs_conn) {
+		ctx->dfs_conn = true;
+		cifs_mount_put_conns(mnt_ctx);
+		rc = get_session(mnt_ctx, NULL);
+	}
+	if (!rc) {
+		set_root_smb_session(mnt_ctx);
+		rc = __dfs_mount_share(mnt_ctx);
+	}
 	return rc;
 }
 
diff --git a/fs/smb/client/dfs.h b/fs/smb/client/dfs.h
index e5c4dcf837503..1aa2bc65b3bc2 100644
--- a/fs/smb/client/dfs.h
+++ b/fs/smb/client/dfs.h
@@ -19,6 +19,7 @@
 struct dfs_ref {
 	char *path;
 	char *full_path;
+	struct cifs_ses *ses;
 	struct dfs_cache_tgt_list tl;
 	struct dfs_cache_tgt_iterator *tit;
 };
@@ -38,6 +39,7 @@ struct dfs_ref_walk {
 #define ref_walk_path(w)	(ref_walk_cur(w)->path)
 #define ref_walk_fpath(w)	(ref_walk_cur(w)->full_path)
 #define ref_walk_tl(w)		(&ref_walk_cur(w)->tl)
+#define ref_walk_ses(w)	(ref_walk_cur(w)->ses)
 
 static inline struct dfs_ref_walk *ref_walk_alloc(void)
 {
@@ -60,14 +62,19 @@ static inline void __ref_walk_free(struct dfs_ref *ref)
 	kfree(ref->path);
 	kfree(ref->full_path);
 	dfs_cache_free_tgts(&ref->tl);
+	if (ref->ses)
+		cifs_put_smb_ses(ref->ses);
 	memset(ref, 0, sizeof(*ref));
 }
 
 static inline void ref_walk_free(struct dfs_ref_walk *rw)
 {
-	struct dfs_ref *ref = ref_walk_start(rw);
+	struct dfs_ref *ref;
 
-	for (; ref <= ref_walk_end(rw); ref++)
+	if (!rw)
+		return;
+
+	for (ref = ref_walk_start(rw); ref <= ref_walk_end(rw); ref++)
 		__ref_walk_free(ref);
 	kfree(rw);
 }
@@ -116,9 +123,22 @@ static inline void ref_walk_set_tgt_hint(struct dfs_ref_walk *rw)
 				       ref_walk_tit(rw));
 }
 
+static inline void ref_walk_set_tcon(struct dfs_ref_walk *rw,
+				     struct cifs_tcon *tcon)
+{
+	struct dfs_ref *ref = ref_walk_start(rw);
+
+	for (; ref <= ref_walk_cur(rw); ref++) {
+		if (WARN_ON_ONCE(!ref->ses))
+			continue;
+		list_add(&ref->ses->dlist, &tcon->dfs_ses_list);
+		ref->ses = NULL;
+	}
+}
+
 int dfs_parse_target_referral(const char *full_path, const struct dfs_info3_param *ref,
 			      struct smb3_fs_context *ctx);
-int dfs_mount_share(struct cifs_mount_ctx *mnt_ctx, bool *isdfs);
+int dfs_mount_share(struct cifs_mount_ctx *mnt_ctx);
 
 static inline char *dfs_get_path(struct cifs_sb_info *cifs_sb, const char *path)
 {
@@ -142,20 +162,14 @@ static inline int dfs_get_referral(struct cifs_mount_ctx *mnt_ctx, const char *p
  * references of all DFS root sessions that were used across the mount process
  * in dfs_mount_share().
  */
-static inline void dfs_put_root_smb_sessions(struct cifs_mount_ctx *mnt_ctx)
+static inline void dfs_put_root_smb_sessions(struct list_head *head)
 {
-	const struct smb3_fs_context *ctx = mnt_ctx->fs_ctx;
-	struct cifs_ses *ses = ctx->dfs_root_ses;
-	struct cifs_ses *cur;
-
-	if (!ses)
-		return;
+	struct cifs_ses *ses, *n;
 
-	for (cur = ses; cur; cur = cur->dfs_root_ses) {
-		if (cur->dfs_root_ses)
-			cifs_put_smb_ses(cur->dfs_root_ses);
+	list_for_each_entry_safe(ses, n, head, dlist) {
+		list_del_init(&ses->dlist);
+		cifs_put_smb_ses(ses);
 	}
-	cifs_put_smb_ses(ses);
 }
 
 #endif /* _CIFS_DFS_H */
diff --git a/fs/smb/client/dfs_cache.c b/fs/smb/client/dfs_cache.c
index 3cf7c88489be4..433f546055b97 100644
--- a/fs/smb/client/dfs_cache.c
+++ b/fs/smb/client/dfs_cache.c
@@ -1336,9 +1336,8 @@ void dfs_cache_refresh(struct work_struct *work)
 	struct cifs_ses *ses;
 
 	tcon = container_of(work, struct cifs_tcon, dfs_cache_work.work);
-	ses = tcon->ses->dfs_root_ses;
 
-	for (; ses; ses = ses->dfs_root_ses)
+	list_for_each_entry(ses, &tcon->dfs_ses_list, dlist)
 		refresh_ses_referral(ses);
 	refresh_tcon_referral(tcon, false);
 
diff --git a/fs/smb/client/fs_context.h b/fs/smb/client/fs_context.h
index d0a2043ea4468..52ee72e562f5f 100644
--- a/fs/smb/client/fs_context.h
+++ b/fs/smb/client/fs_context.h
@@ -287,6 +287,7 @@ struct smb3_fs_context {
 	struct cifs_ses *dfs_root_ses;
 	bool dfs_automount:1; /* set for dfs automount only */
 	enum cifs_reparse_type reparse_type;
+	bool dfs_conn:1; /* set for dfs mounts */
 };
 
 extern const struct fs_parameter_spec smb3_fs_parameters[];
diff --git a/fs/smb/client/misc.c b/fs/smb/client/misc.c
index 9e8e0a01ae8eb..2e9a14e28e466 100644
--- a/fs/smb/client/misc.c
+++ b/fs/smb/client/misc.c
@@ -145,6 +145,9 @@ tcon_info_alloc(bool dir_leases_enabled, enum smb3_tcon_ref_trace trace)
 	mutex_init(&ret_buf->fscache_lock);
 #endif
 	trace_smb3_tcon_ref(ret_buf->debug_id, ret_buf->tc_count, trace);
+#ifdef CONFIG_CIFS_DFS_UPCALL
+	INIT_LIST_HEAD(&ret_buf->dfs_ses_list);
+#endif
 
 	return ret_buf;
 }
diff --git a/fs/smb/client/namespace.c b/fs/smb/client/namespace.c
index ec58c0e507244..a6655807c0865 100644
--- a/fs/smb/client/namespace.c
+++ b/fs/smb/client/namespace.c
@@ -260,7 +260,7 @@ static struct vfsmount *cifs_do_automount(struct path *path)
 		ctx->source = NULL;
 		goto out;
 	}
-	ctx->dfs_automount = is_dfs_mount(mntpt);
+	ctx->dfs_automount = ctx->dfs_conn = is_dfs_mount(mntpt);
 	cifs_dbg(FYI, "%s: ctx: source=%s UNC=%s prepath=%s dfs_automount=%d\n",
 		 __func__, ctx->source, ctx->UNC, ctx->prepath, ctx->dfs_automount);
 
-- 
2.39.5




  parent reply	other threads:[~2025-07-15 13:27 UTC|newest]

Thread overview: 112+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-15 13:12 [PATCH 6.6 000/109] 6.6.99-rc1 review Greg Kroah-Hartman
2025-07-15 13:12 ` [PATCH 6.6 001/109] eventpoll: dont decrement ep refcount while still holding the ep mutex Greg Kroah-Hartman
2025-07-15 13:12 ` [PATCH 6.6 002/109] drm/exynos: exynos7_drm_decon: add vblank check in IRQ handling Greg Kroah-Hartman
2025-07-15 13:12 ` [PATCH 6.6 003/109] ASoC: fsl_asrc: use internal measured ratio for non-ideal ratio mode Greg Kroah-Hartman
2025-07-15 13:12 ` [PATCH 6.6 004/109] perf/core: Fix the WARN_ON_ONCE is out of lock protected region Greg Kroah-Hartman
2025-07-15 13:12 ` [PATCH 6.6 005/109] perf: Revert to requiring CAP_SYS_ADMIN for uprobes Greg Kroah-Hartman
2025-07-15 13:12 ` [PATCH 6.6 006/109] ASoC: cs35l56: probe() should fail if the device ID is not recognized Greg Kroah-Hartman
2025-07-15 13:12 ` [PATCH 6.6 007/109] Bluetooth: hci_sync: Fix not disabling advertising instance Greg Kroah-Hartman
2025-07-15 13:12 ` [PATCH 6.6 008/109] Bluetooth: hci_event: Fix not marking Broadcast Sink BIS as connected Greg Kroah-Hartman
2025-07-15 13:12 ` [PATCH 6.6 009/109] pinctrl: amd: Clear GPIO debounce for suspend Greg Kroah-Hartman
2025-07-15 13:12 ` [PATCH 6.6 010/109] fix proc_sys_compare() handling of in-lookup dentries Greg Kroah-Hartman
2025-07-15 13:12 ` [PATCH 6.6 011/109] netlink: Fix wraparounds of sk->sk_rmem_alloc Greg Kroah-Hartman
2025-07-15 13:12 ` [PATCH 6.6 012/109] vsock: fix `vsock_proto` declaration Greg Kroah-Hartman
2025-07-15 13:12 ` [PATCH 6.6 013/109] tipc: Fix use-after-free in tipc_conn_close() Greg Kroah-Hartman
2025-07-15 13:12 ` [PATCH 6.6 014/109] tcp: Correct signedness in skb remaining space calculation Greg Kroah-Hartman
2025-07-15 13:12 ` [PATCH 6.6 015/109] vsock: Fix transport_{g2h,h2g} TOCTOU Greg Kroah-Hartman
2025-07-15 13:12 ` [PATCH 6.6 016/109] vsock: Fix transport_* TOCTOU Greg Kroah-Hartman
2025-07-15 13:12 ` [PATCH 6.6 017/109] vsock: Fix IOCTL_VM_SOCKETS_GET_LOCAL_CID to check also `transport_local` Greg Kroah-Hartman
2025-07-15 13:12 ` [PATCH 6.6 018/109] net: stmmac: Fix interrupt handling for level-triggered mode in DWC_XGMAC2 Greg Kroah-Hartman
2025-07-15 13:12 ` [PATCH 6.6 019/109] net: phy: smsc: Fix Auto-MDIX configuration when disabled by strap Greg Kroah-Hartman
2025-07-15 13:12 ` [PATCH 6.6 020/109] net: phy: smsc: Force predictable MDI-X state on LAN87xx Greg Kroah-Hartman
2025-07-15 13:12 ` [PATCH 6.6 021/109] net: phy: smsc: Fix link failure in forced mode with Auto-MDIX Greg Kroah-Hartman
2025-07-15 13:12 ` [PATCH 6.6 022/109] atm: clip: Fix potential null-ptr-deref in to_atmarpd() Greg Kroah-Hartman
2025-07-15 13:12 ` [PATCH 6.6 023/109] atm: clip: Fix memory leak of struct clip_vcc Greg Kroah-Hartman
2025-07-15 13:12 ` [PATCH 6.6 024/109] atm: clip: Fix infinite recursive call of clip_push() Greg Kroah-Hartman
2025-07-15 13:12 ` [PATCH 6.6 025/109] atm: clip: Fix NULL pointer dereference in vcc_sendmsg() Greg Kroah-Hartman
2025-07-15 13:12 ` [PATCH 6.6 026/109] net/sched: Abort __tc_modify_qdisc if parent class does not exist Greg Kroah-Hartman
2025-07-15 13:12 ` [PATCH 6.6 027/109] rxrpc: Fix bug due to prealloc collision Greg Kroah-Hartman
2025-07-15 13:12 ` [PATCH 6.6 028/109] maple_tree: fix MA_STATE_PREALLOC flag in mas_preallocate() Greg Kroah-Hartman
2025-07-15 13:12 ` [PATCH 6.6 029/109] perf: build: Setup PKG_CONFIG_LIBDIR for cross compilation Greg Kroah-Hartman
2025-07-15 13:12 ` [PATCH 6.6 030/109] Bluetooth: HCI: Set extended advertising data synchronously Greg Kroah-Hartman
2025-07-15 13:12 ` [PATCH 6.6 031/109] rxrpc: Fix oops due to non-existence of prealloc backlog struct Greg Kroah-Hartman
2025-07-15 13:12 ` [PATCH 6.6 032/109] ipmi:msghandler: Fix potential memory corruption in ipmi_create_user() Greg Kroah-Hartman
2025-07-15 13:12 ` [PATCH 6.6 033/109] x86/mce/amd: Add default names for MCA banks and blocks Greg Kroah-Hartman
2025-07-15 13:12 ` [PATCH 6.6 034/109] x86/mce/amd: Fix threshold limit reset Greg Kroah-Hartman
2025-07-15 13:12 ` [PATCH 6.6 035/109] x86/mce: Dont remove sysfs if thresholding sysfs init fails Greg Kroah-Hartman
2025-07-15 13:12 ` [PATCH 6.6 036/109] x86/mce: Make sure CMCI banks are cleared during shutdown on Intel Greg Kroah-Hartman
2025-07-15 13:12 ` [PATCH 6.6 037/109] KVM: x86/xen: Allow out of range event channel ports in IRQ routing table Greg Kroah-Hartman
2025-07-15 13:12 ` [PATCH 6.6 038/109] KVM: SVM: Reject SEV{-ES} intra host migration if vCPU creation is in-flight Greg Kroah-Hartman
2025-07-15 13:12 ` [PATCH 6.6 039/109] gre: Fix IPv6 multicast route creation Greg Kroah-Hartman
2025-07-15 13:12 ` [PATCH 6.6 040/109] md/md-bitmap: fix GPF in bitmap_get_stats() Greg Kroah-Hartman
2025-07-15 13:12 ` [PATCH 6.6 041/109] pinctrl: qcom: msm: mark certain pins as invalid for interrupts Greg Kroah-Hartman
2025-07-15 13:12 ` [PATCH 6.6 042/109] wifi: prevent A-MSDU attacks in mesh networks Greg Kroah-Hartman
2025-07-15 13:12 ` [PATCH 6.6 043/109] drm/gem: Acquire references on GEM handles for framebuffers Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 044/109] drm/sched: Increment job count before swapping tail spsc queue Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 045/109] drm/ttm: fix error handling in ttm_buffer_object_transfer Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 046/109] drm/gem: Fix race in drm_gem_handle_create_tail() Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 047/109] usb: gadget: u_serial: Fix race condition in TTY wakeup Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 048/109] Revert "usb: gadget: u_serial: Add null pointer check in gs_start_io" Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 049/109] drm/framebuffer: Acquire internal references on GEM handles Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 050/109] Revert "ACPI: battery: negate current when discharging" Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 051/109] kallsyms: fix build without execinfo Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 052/109] maple_tree: fix mt_destroy_walk() on root leaf node Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 053/109] mm: fix the inaccurate memory statistics issue for users Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 054/109] scripts/gdb: fix interrupts display after MCP on x86 Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 055/109] scripts/gdb: de-reference per-CPU MCE interrupts Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 056/109] scripts/gdb: fix interrupts.py after maple tree conversion Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 057/109] mm/vmalloc: leave lazy MMU mode on PTE mapping error Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 058/109] pwm: mediatek: Ensure to disable clocks in error path Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 059/109] x86/rdrand: Disable RDSEED on AMD Cyan Skillfish Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 060/109] x86/mm: Disable hugetlb page table sharing on 32-bit Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 061/109] smb: server: make use of rdma_destroy_qp() Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 062/109] ksmbd: fix a mount write count leak in ksmbd_vfs_kern_path_locked() Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 063/109] erofs: fix to add missing tracepoint in erofs_read_folio() Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 064/109] netlink: Fix rmem check in netlink_broadcast_deliver() Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 065/109] netlink: make sure we allow at least one dump skb Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 066/109] btrfs: remove noinline from btrfs_update_inode() Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 067/109] btrfs: remove redundant root argument from btrfs_update_inode_fallback() Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 068/109] btrfs: remove redundant root argument from fixup_inode_link_count() Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 069/109] btrfs: return a btrfs_inode from btrfs_iget_logging() Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 070/109] btrfs: fix inode lookup error handling during log replay Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 071/109] usb:cdnsp: remove TRB_FLUSH_ENDPOINT command Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 072/109] usb: cdnsp: Replace snprintf() with the safer scnprintf() variant Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 073/109] usb: cdnsp: Fix issue with CV Bad Descriptor test Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 074/109] usb: dwc3: Abort suspend on soft disconnect failure Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 075/109] smb: client: avoid unnecessary reconnects when refreshing referrals Greg Kroah-Hartman
2025-07-15 13:13 ` Greg Kroah-Hartman [this message]
2025-07-15 13:13 ` [PATCH 6.6 077/109] cifs: all initializations for tcon should happen in tcon_info_alloc Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 078/109] wifi: zd1211rw: Fix potential NULL pointer dereference in zd_mac_tx_to_dev() Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 079/109] drm/tegra: nvdec: Fix dma_alloc_coherent error check Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 080/109] md/raid1: Fix stack memory use after return in raid1_reshape Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 081/109] raid10: cleanup memleak at raid10_make_request Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 082/109] nbd: fix uaf in nbd_genl_connect() error path Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 083/109] netfilter: flowtable: account for Ethernet header in nf_flow_pppoe_proto() Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 084/109] net: appletalk: Fix device refcount leak in atrtr_create() Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 085/109] ibmvnic: Fix hardcoded NUM_RX_STATS/NUM_TX_STATS with dynamic sizeof Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 086/109] net: phy: microchip: limit 100M workaround to link-down events on LAN88xx Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 087/109] can: m_can: m_can_handle_lost_msg(): downgrade msg lost in rx message to debug level Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 088/109] net: ll_temac: Fix missing tx_pending check in ethtools_set_ringparam() Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 089/109] bnxt_en: Fix DCB ETS validation Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 090/109] bnxt_en: Set DMA unmap len correctly for XDP_REDIRECT Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 091/109] ublk: sanity check add_dev input for underflow Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 092/109] atm: idt77252: Add missing `dma_map_error()` Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 093/109] um: vector: Reduce stack usage in vector_eth_configure() Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 094/109] io_uring: make fallocate be hashed work Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 095/109] ASoC: amd: yc: add quirk for Acer Nitro ANV15-41 internal mic Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 096/109] ALSA: hda/realtek - Enable mute LED on HP Pavilion Laptop 15-eg100 Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 097/109] net: usb: qmi_wwan: add SIMCom 8230C composition Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 098/109] HID: lenovo: Add support for ThinkPad X1 Tablet Thin Keyboard Gen2 Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 099/109] net: mana: Record doorbell physical address in PF mode Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 100/109] btrfs: fix assertion when building free space tree Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 101/109] vt: add missing notification when switching back to text mode Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 102/109] bpf: Adjust free target to avoid global starvation of LRU map Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 6.6 103/109] HID: Add IGNORE quirk for SMARTLINKTECHNOLOGY Greg Kroah-Hartman
2025-07-15 13:14 ` [PATCH 6.6 104/109] HID: quirks: Add quirk for 2 Chicony Electronics HP 5MP Cameras Greg Kroah-Hartman
2025-07-15 13:14 ` [PATCH 6.6 105/109] Input: atkbd - do not skip atkbd_deactivate() when skipping ATKBD_CMD_GETID Greg Kroah-Hartman
2025-07-15 13:14 ` [PATCH 6.6 106/109] selftests/bpf: adapt one more case in test_lru_map to the new target_free Greg Kroah-Hartman
2025-07-15 13:14 ` [PATCH 6.6 107/109] smb: client: fix potential race in cifs_put_tcon() Greg Kroah-Hartman
2025-07-15 13:14 ` [PATCH 6.6 108/109] kasan: remove kasan_find_vm_area() to prevent possible deadlock Greg Kroah-Hartman
2025-07-15 13:14 ` [PATCH 6.6 109/109] ksmbd: fix potential use-after-free in oplock/lease break ack Greg Kroah-Hartman
2025-07-15 17:00 ` [PATCH 6.6 000/109] 6.6.99-rc1 review Miguel Ojeda
2025-07-16 14:53 ` Shuah Khan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250715130801.927312731@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=patches@lists.linux.dev \
    --cc=pc@manguebit.com \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=stfrench@microsoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).