Linux kernel -stable discussions
 help / color / mirror / Atom feed
* FAILED: patch "[PATCH] smb: client: convert path_consumed to mount charset units" failed to apply to 6.12-stable tree
@ 2026-12-02 16:05 gregkh
  2026-12-04 12:27 ` [PATCH 6.12.y 1/2] smb: client: optimize referral walk on failed link targets Sasha Levin
  0 siblings, 1 reply; 3+ messages in thread
From: gregkh @ 2026-12-02 16:05 UTC (permalink / raw)
  To: fredric.cover.lkernel, pc; +Cc: stable


The patch below does not apply to the 6.12-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y
git checkout FETCH_HEAD
git cherry-pick -x 3a191eec3627acd558640cf4092e9e337aa15291
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<stable@vger.kernel.org>' --in-reply-to '2026120224-sensuous-enunciate-2483@gregkh' --subject-prefix 'PATCH 6.12.y' 'HEAD^..'

Possible dependencies:



thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 3a191eec3627acd558640cf4092e9e337aa15291 Mon Sep 17 00:00:00 2001
From: Fredric Cover <fredric.cover.lkernel@gmail.com>
Date: Thu, 12 Nov 2026 04:21:36 +0000
Subject: [PATCH] smb: client: convert path_consumed to mount charset units
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

path_consumed in a DFS referral counts bytes of the canonical path,
which is in the DFS cache charset (utf8). dfs_parse_target_referral()
applies it as an offset into full_path, which is in the mount charset.
When the mount charset is not utf8, each non-ASCII character in the
consumed part that encodes longer in utf8 than in the mount charset
makes the offset too large, so leading characters of the prefix path
are dropped. For example, with iocharset=iso8859-1, mounting
//srv/dfs/café é/sub yields the prefix "ub" instead of "sub" and the
mount fails with -ENOENT. (A single accented character only worked
because the offset happened to land after the delimiter.)

Translate the count in parse_dfs_target(), where both strings are
available, by matching path components: count the delimiters in the
consumed part of the canonical path and find the same position in the
mount charset path. Delimiters are ASCII in both and are not affected
by remapping. If the consumed bytes are identical in both strings,
which is the case for utf8 mounts and ASCII-only prefixes using the
default backslash delimiter, the value is used unchanged.

This assumes the server reports PathConsumed on a component boundary;
a translated value that ends mid-component is rounded up to the next
boundary.

Tested against Samba on a KASAN kernel: with iocharset=iso8859-1, links
with 0 to 3 accented characters followed by a tail, a two-level tail,
an accented tail, a link in a subdirectory, and mapposix with an
accented name; iso8859-15 and cp932 mounts; and iocharset=utf8
controls. Not tested against Windows servers, with posixpaths, or with
reserved characters under mapchars/mapposix.

Signed-off-by: Fredric Cover <fredric.cover.lkernel@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Paulo Alcantara <pc@manguebit.org>

diff --git a/fs/smb/client/dfs.c b/fs/smb/client/dfs.c
index 57c90a2512a3..788cdda9a573 100644
--- a/fs/smb/client/dfs.c
+++ b/fs/smb/client/dfs.c
@@ -85,16 +85,87 @@ static void set_root_smb_session(struct cifs_mount_ctx *mnt_ctx)
 	ctx->dfs_root_ses = ses;
 }
 
+static bool dfs_is_delim(wchar_t c)
+{
+	return c == '/' || c == '\\';
+}
+
+/*
+ * @consumed counts bytes of the canonical (cache charset) path @cpath.
+ * Return the matching byte offset in @fpath, which holds the same path in
+ * the mount charset.  Offsets are matched by path component, since the
+ * delimiters are ASCII in every charset and survive remapping.
+ */
+static int dfs_consumed_to_local(const struct nls_table *nls,
+				 const char *cpath, const char *fpath,
+				 int consumed)
+{
+	size_t clen = strlen(cpath), flen = strlen(fpath), off = 0;
+	int ndelims = 0, seen = 0, i;
+	bool ends_on_delim;
+
+	if (consumed < 0)
+		return -EINVAL;
+
+	/* Identical bytes in both strings: units already agree */
+	if ((size_t)consumed <= min(clen, flen) &&
+	    !memcmp(cpath, fpath, consumed))
+		return consumed;
+
+	if ((size_t)consumed > clen)
+		consumed = clen;
+
+	for (i = 0; i < consumed; i++)
+		if (dfs_is_delim(cpath[i]))
+			ndelims++;
+	ends_on_delim = consumed && dfs_is_delim(cpath[consumed - 1]);
+
+	while (off < flen) {
+		wchar_t uni;
+		int len;
+
+		len = nls->char2uni((const unsigned char *)fpath + off,
+				    flen - off, &uni);
+		if (len <= 0) {
+			uni = (unsigned char)fpath[off];
+			len = 1;
+		}
+		if (dfs_is_delim(uni)) {
+			/* check if start of next component */
+			if (!ends_on_delim && seen == ndelims)
+				break;
+			seen++;
+			if (ends_on_delim && seen == ndelims) {
+				/* just past the last consumed delimiter */
+				off += len;
+				break;
+			}
+		}
+		off += len;
+	}
+	return off;
+}
+
 static inline int parse_dfs_target(struct smb3_fs_context *ctx,
 				   struct dfs_ref_walk *rw,
 				   struct dfs_info3_param *tgt)
 {
-	int rc;
 	const char *fpath = ref_walk_fpath(rw) + 1;
+	const char *cpath = ref_walk_path(rw) + 1;
+	int rc;
 
 	rc = ref_walk_get_tgt(rw, tgt);
-	if (!rc)
-		rc = dfs_parse_target_referral(fpath, tgt, ctx);
+	if (!rc) {
+		struct dfs_info3_param local = *tgt;
+		int off;
+
+		off = dfs_consumed_to_local(rw->mnt_ctx->cifs_sb->local_nls,
+					    cpath, fpath, tgt->path_consumed);
+		if (off < 0)
+			return off;
+		local.path_consumed = off;
+		rc = dfs_parse_target_referral(fpath, &local, ctx);
+	}
 	return rc;
 }
 


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 6.12.y 1/2] smb: client: optimize referral walk on failed link targets
  2026-12-02 16:05 FAILED: patch "[PATCH] smb: client: convert path_consumed to mount charset units" failed to apply to 6.12-stable tree gregkh
@ 2026-12-04 12:27 ` Sasha Levin
  2026-12-04 12:27   ` [PATCH 6.12.y 2/2] smb: client: convert path_consumed to mount charset units Sasha Levin
  0 siblings, 1 reply; 3+ messages in thread
From: Sasha Levin @ 2026-12-04 12:27 UTC (permalink / raw)
  To: stable; +Cc: Paulo Alcantara, Steve French, Sasha Levin

From: Paulo Alcantara <pc@manguebit.com>

[ Upstream commit 5433c629e8d4eee77233a2bc88075886dc6e37ef ]

If a link referral request sent to root server was successful but
client failed to connect to all link targets, there is no need to
retry same link referral on a different root server.  Set an end
marker for the DFS root referral so the client will not attempt to
re-send link referrals to different root servers on failures.

Signed-off-by: Paulo Alcantara (Red Hat) <pc@manguebit.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Stable-dep-of: 3a191eec3627 ("smb: client: convert path_consumed to mount charset units")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/smb/client/dfs.c | 69 +++++++++++++++++----------------------------
 fs/smb/client/dfs.h | 44 ++++++++++++++++++++---------
 2 files changed, 56 insertions(+), 57 deletions(-)

diff --git a/fs/smb/client/dfs.c b/fs/smb/client/dfs.c
index 9526fdd9a5707..06d9cac3c686e 100644
--- a/fs/smb/client/dfs.c
+++ b/fs/smb/client/dfs.c
@@ -95,15 +95,16 @@ static inline int parse_dfs_target(struct smb3_fs_context *ctx,
 	return rc;
 }
 
-static int setup_dfs_ref(struct cifs_mount_ctx *mnt_ctx,
-			 struct dfs_info3_param *tgt,
-			 struct dfs_ref_walk *rw)
+static int setup_dfs_ref(struct dfs_info3_param *tgt, struct dfs_ref_walk *rw)
 {
-	struct smb3_fs_context *ctx = mnt_ctx->fs_ctx;
-	struct cifs_sb_info *cifs_sb = mnt_ctx->cifs_sb;
+	struct cifs_sb_info *cifs_sb = rw->mnt_ctx->cifs_sb;
+	struct smb3_fs_context *ctx = rw->mnt_ctx->fs_ctx;
 	char *ref_path, *full_path;
 	int rc;
 
+	set_root_smb_session(rw->mnt_ctx);
+	ref_walk_ses(rw) = ctx->dfs_root_ses;
+
 	full_path = smb3_fs_context_fullpath(ctx, CIFS_DIR_SEP(cifs_sb));
 	if (IS_ERR(full_path))
 		return PTR_ERR(full_path);
@@ -120,35 +121,22 @@ static int setup_dfs_ref(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;
+
+	return dfs_get_referral(rw->mnt_ctx,
+				ref_walk_path(rw) + 1,
+				ref_walk_tl(rw));
 }
 
-static int __dfs_referral_walk(struct cifs_mount_ctx *mnt_ctx,
-			       struct dfs_ref_walk *rw)
+static int __dfs_referral_walk(struct dfs_ref_walk *rw)
 {
-	struct smb3_fs_context *ctx = mnt_ctx->fs_ctx;
+	struct smb3_fs_context *ctx = rw->mnt_ctx->fs_ctx;
+	struct cifs_mount_ctx *mnt_ctx = rw->mnt_ctx;
 	struct dfs_info3_param tgt = {};
 	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));
-			if (rc) {
-				rc = cifs_mount_get_tcon(mnt_ctx);
-				if (!rc)
-					rc = cifs_is_path_remote(mnt_ctx);
-				continue;
-			}
-			if (!ref_walk_num_tgts(rw)) {
-				rc = -ENOENT;
-				continue;
-			}
-		}
-
 		while (ref_walk_next_tgt(rw)) {
 			rc = parse_dfs_target(ctx, rw, &tgt);
 			if (rc)
@@ -159,32 +147,29 @@ static int __dfs_referral_walk(struct cifs_mount_ctx *mnt_ctx,
 			if (rc)
 				continue;
 
-			ref_walk_set_tgt_hint(rw);
 			if (tgt.flags & DFSREF_STORAGE_SERVER) {
 				rc = cifs_mount_get_tcon(mnt_ctx);
 				if (!rc)
 					rc = cifs_is_path_remote(mnt_ctx);
-				if (!rc)
+				if (!rc) {
+					ref_walk_set_tgt_hint(rw);
 					break;
+				}
 				if (rc != -EREMOTE)
 					continue;
 			}
 
-			set_root_smb_session(mnt_ctx);
 			rc = ref_walk_advance(rw);
 			if (!rc) {
-				rc = setup_dfs_ref(mnt_ctx, &tgt, rw);
-				if (!rc) {
-					rc = -EREMOTE;
-					goto again;
-				}
+				rc = setup_dfs_ref(&tgt, rw);
+				if (rc)
+					break;
+				ref_walk_mark_end(rw);
+				goto again;
 			}
-			if (rc != -ELOOP)
-				goto out;
 		}
 	} while (rc && ref_walk_descend(rw));
 
-out:
 	free_dfs_info_param(&tgt);
 	return rc;
 }
@@ -201,10 +186,10 @@ static int dfs_referral_walk(struct cifs_mount_ctx *mnt_ctx,
 		return rc;
 	}
 
-	ref_walk_init(*rw);
-	rc = setup_dfs_ref(mnt_ctx, NULL, *rw);
+	ref_walk_init(*rw, mnt_ctx);
+	rc = setup_dfs_ref(NULL, *rw);
 	if (!rc)
-		rc = __dfs_referral_walk(mnt_ctx, *rw);
+		rc = __dfs_referral_walk(*rw);
 	return rc;
 }
 
@@ -294,7 +279,7 @@ int dfs_mount_share(struct cifs_mount_ctx *mnt_ctx)
 	 * to respond with PATH_NOT_COVERED to requests that include the prefix.
 	 */
 	if (!nodfs) {
-		rc = dfs_get_referral(mnt_ctx, ctx->UNC + 1, NULL, NULL);
+		rc = dfs_get_referral(mnt_ctx, ctx->UNC + 1, NULL);
 		if (rc) {
 			cifs_dbg(FYI, "%s: no dfs referral for %s: %d\n",
 				 __func__, ctx->UNC + 1, rc);
@@ -314,10 +299,8 @@ int dfs_mount_share(struct cifs_mount_ctx *mnt_ctx)
 		cifs_mount_put_conns(mnt_ctx);
 		rc = get_session(mnt_ctx, NULL);
 	}
-	if (!rc) {
-		set_root_smb_session(mnt_ctx);
+	if (!rc)
 		rc = __dfs_mount_share(mnt_ctx);
-	}
 	return rc;
 }
 
diff --git a/fs/smb/client/dfs.h b/fs/smb/client/dfs.h
index 1aa2bc65b3bc2..ed4cd7cf1ec64 100644
--- a/fs/smb/client/dfs.h
+++ b/fs/smb/client/dfs.h
@@ -12,6 +12,7 @@
 #include "dfs_cache.h"
 #include "cifs_unicode.h"
 #include <linux/namei.h>
+#include <linux/errno.h>
 
 #define DFS_INTERLINK(v) \
 	(((v) & DFSREF_REFERRAL_SERVER) && !((v) & DFSREF_STORAGE_SERVER))
@@ -25,8 +26,9 @@ struct dfs_ref {
 };
 
 struct dfs_ref_walk {
-	struct dfs_ref *ref;
-	struct dfs_ref refs[MAX_NESTED_LINKS];
+	struct cifs_mount_ctx	*mnt_ctx;
+	struct dfs_ref		*ref;
+	struct dfs_ref		refs[MAX_NESTED_LINKS];
 };
 
 #define ref_walk_start(w)	((w)->refs)
@@ -35,7 +37,6 @@ struct dfs_ref_walk {
 #define ref_walk_descend(w)	(--ref_walk_cur(w) >= ref_walk_start(w))
 
 #define ref_walk_tit(w)	(ref_walk_cur(w)->tit)
-#define ref_walk_empty(w)	(!ref_walk_tit(w))
 #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)
@@ -51,9 +52,11 @@ static inline struct dfs_ref_walk *ref_walk_alloc(void)
 	return rw;
 }
 
-static inline void ref_walk_init(struct dfs_ref_walk *rw)
+static inline void ref_walk_init(struct dfs_ref_walk *rw,
+				 struct cifs_mount_ctx *mnt_ctx)
 {
 	memset(rw, 0, sizeof(*rw));
+	rw->mnt_ctx = mnt_ctx;
 	ref_walk_cur(rw) = ref_walk_start(rw);
 }
 
@@ -93,15 +96,23 @@ static inline int ref_walk_advance(struct dfs_ref_walk *rw)
 static inline struct dfs_cache_tgt_iterator *
 ref_walk_next_tgt(struct dfs_ref_walk *rw)
 {
-	struct dfs_cache_tgt_iterator *tit;
 	struct dfs_ref *ref = ref_walk_cur(rw);
+	struct dfs_cache_tgt_iterator *tit;
+
+	if (IS_ERR(ref->tit))
+		return NULL;
 
 	if (!ref->tit)
 		tit = dfs_cache_get_tgt_iterator(&ref->tl);
 	else
 		tit = dfs_cache_get_next_tgt(&ref->tl, ref->tit);
+
+	if (!tit) {
+		ref->tit = ERR_PTR(-ENOENT);
+		return NULL;
+	}
 	ref->tit = tit;
-	return tit;
+	return ref->tit;
 }
 
 static inline int ref_walk_get_tgt(struct dfs_ref_walk *rw,
@@ -112,11 +123,6 @@ static inline int ref_walk_get_tgt(struct dfs_ref_walk *rw,
 					  ref_walk_tit(rw), tgt);
 }
 
-static inline int ref_walk_num_tgts(struct dfs_ref_walk *rw)
-{
-	return dfs_cache_get_nr_tgts(ref_walk_tl(rw));
-}
-
 static inline void ref_walk_set_tgt_hint(struct dfs_ref_walk *rw)
 {
 	dfs_cache_noreq_update_tgthint(ref_walk_path(rw) + 1,
@@ -136,6 +142,15 @@ static inline void ref_walk_set_tcon(struct dfs_ref_walk *rw,
 	}
 }
 
+static inline void ref_walk_mark_end(struct dfs_ref_walk *rw)
+{
+	struct dfs_ref *ref = ref_walk_cur(rw) - 1;
+
+	WARN_ON_ONCE(ref < ref_walk_start(rw));
+	dfs_cache_noreq_update_tgthint(ref->path + 1, ref->tit);
+	ref->tit = ERR_PTR(-ENOENT); /* end marker */
+}
+
 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);
@@ -145,15 +160,16 @@ static inline char *dfs_get_path(struct cifs_sb_info *cifs_sb, const char *path)
 	return dfs_cache_canonical_path(path, cifs_sb->local_nls, cifs_remap(cifs_sb));
 }
 
-static inline int dfs_get_referral(struct cifs_mount_ctx *mnt_ctx, const char *path,
-				   struct dfs_info3_param *ref, struct dfs_cache_tgt_list *tl)
+static inline int dfs_get_referral(struct cifs_mount_ctx *mnt_ctx,
+				   const char *path,
+				   struct dfs_cache_tgt_list *tl)
 {
 	struct smb3_fs_context *ctx = mnt_ctx->fs_ctx;
 	struct cifs_sb_info *cifs_sb = mnt_ctx->cifs_sb;
 	struct cifs_ses *rses = ctx->dfs_root_ses ?: mnt_ctx->ses;
 
 	return dfs_cache_find(mnt_ctx->xid, rses, cifs_sb->local_nls,
-			      cifs_remap(cifs_sb), path, ref, tl);
+			      cifs_remap(cifs_sb), path, NULL, tl);
 }
 
 /*
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 6.12.y 2/2] smb: client: convert path_consumed to mount charset units
  2026-12-04 12:27 ` [PATCH 6.12.y 1/2] smb: client: optimize referral walk on failed link targets Sasha Levin
@ 2026-12-04 12:27   ` Sasha Levin
  0 siblings, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2026-12-04 12:27 UTC (permalink / raw)
  To: stable; +Cc: Fredric Cover, Paulo Alcantara, Sasha Levin

From: Fredric Cover <fredric.cover.lkernel@gmail.com>

[ Upstream commit 3a191eec3627acd558640cf4092e9e337aa15291 ]

path_consumed in a DFS referral counts bytes of the canonical path,
which is in the DFS cache charset (utf8). dfs_parse_target_referral()
applies it as an offset into full_path, which is in the mount charset.
When the mount charset is not utf8, each non-ASCII character in the
consumed part that encodes longer in utf8 than in the mount charset
makes the offset too large, so leading characters of the prefix path
are dropped. For example, with iocharset=iso8859-1, mounting
//srv/dfs/café é/sub yields the prefix "ub" instead of "sub" and the
mount fails with -ENOENT. (A single accented character only worked
because the offset happened to land after the delimiter.)

Translate the count in parse_dfs_target(), where both strings are
available, by matching path components: count the delimiters in the
consumed part of the canonical path and find the same position in the
mount charset path. Delimiters are ASCII in both and are not affected
by remapping. If the consumed bytes are identical in both strings,
which is the case for utf8 mounts and ASCII-only prefixes using the
default backslash delimiter, the value is used unchanged.

This assumes the server reports PathConsumed on a component boundary;
a translated value that ends mid-component is rounded up to the next
boundary.

Tested against Samba on a KASAN kernel: with iocharset=iso8859-1, links
with 0 to 3 accented characters followed by a tail, a two-level tail,
an accented tail, a link in a subdirectory, and mapposix with an
accented name; iso8859-15 and cp932 mounts; and iocharset=utf8
controls. Not tested against Windows servers, with posixpaths, or with
reserved characters under mapchars/mapposix.

Signed-off-by: Fredric Cover <fredric.cover.lkernel@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Paulo Alcantara <pc@manguebit.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/smb/client/dfs.c | 77 +++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 74 insertions(+), 3 deletions(-)

diff --git a/fs/smb/client/dfs.c b/fs/smb/client/dfs.c
index 06d9cac3c686e..c440f2e380f88 100644
--- a/fs/smb/client/dfs.c
+++ b/fs/smb/client/dfs.c
@@ -82,16 +82,87 @@ static void set_root_smb_session(struct cifs_mount_ctx *mnt_ctx)
 	ctx->dfs_root_ses = ses;
 }
 
+static bool dfs_is_delim(wchar_t c)
+{
+	return c == '/' || c == '\\';
+}
+
+/*
+ * @consumed counts bytes of the canonical (cache charset) path @cpath.
+ * Return the matching byte offset in @fpath, which holds the same path in
+ * the mount charset.  Offsets are matched by path component, since the
+ * delimiters are ASCII in every charset and survive remapping.
+ */
+static int dfs_consumed_to_local(const struct nls_table *nls,
+				 const char *cpath, const char *fpath,
+				 int consumed)
+{
+	size_t clen = strlen(cpath), flen = strlen(fpath), off = 0;
+	int ndelims = 0, seen = 0, i;
+	bool ends_on_delim;
+
+	if (consumed < 0)
+		return -EINVAL;
+
+	/* Identical bytes in both strings: units already agree */
+	if ((size_t)consumed <= min(clen, flen) &&
+	    !memcmp(cpath, fpath, consumed))
+		return consumed;
+
+	if ((size_t)consumed > clen)
+		consumed = clen;
+
+	for (i = 0; i < consumed; i++)
+		if (dfs_is_delim(cpath[i]))
+			ndelims++;
+	ends_on_delim = consumed && dfs_is_delim(cpath[consumed - 1]);
+
+	while (off < flen) {
+		wchar_t uni;
+		int len;
+
+		len = nls->char2uni((const unsigned char *)fpath + off,
+				    flen - off, &uni);
+		if (len <= 0) {
+			uni = (unsigned char)fpath[off];
+			len = 1;
+		}
+		if (dfs_is_delim(uni)) {
+			/* check if start of next component */
+			if (!ends_on_delim && seen == ndelims)
+				break;
+			seen++;
+			if (ends_on_delim && seen == ndelims) {
+				/* just past the last consumed delimiter */
+				off += len;
+				break;
+			}
+		}
+		off += len;
+	}
+	return off;
+}
+
 static inline int parse_dfs_target(struct smb3_fs_context *ctx,
 				   struct dfs_ref_walk *rw,
 				   struct dfs_info3_param *tgt)
 {
-	int rc;
 	const char *fpath = ref_walk_fpath(rw) + 1;
+	const char *cpath = ref_walk_path(rw) + 1;
+	int rc;
 
 	rc = ref_walk_get_tgt(rw, tgt);
-	if (!rc)
-		rc = dfs_parse_target_referral(fpath, tgt, ctx);
+	if (!rc) {
+		struct dfs_info3_param local = *tgt;
+		int off;
+
+		off = dfs_consumed_to_local(rw->mnt_ctx->cifs_sb->local_nls,
+					    cpath, fpath, tgt->path_consumed);
+		if (off < 0)
+			return off;
+		local.path_consumed = off;
+		rc = dfs_parse_target_referral(fpath, &local, ctx);
+	}
 	return rc;
 }
 
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-12-04 12:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02 16:05 FAILED: patch "[PATCH] smb: client: convert path_consumed to mount charset units" failed to apply to 6.12-stable tree gregkh
2026-12-04 12:27 ` [PATCH 6.12.y 1/2] smb: client: optimize referral walk on failed link targets Sasha Levin
2026-12-04 12:27   ` [PATCH 6.12.y 2/2] smb: client: convert path_consumed to mount charset units Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox