summaryrefslogtreecommitdiff
path: root/fs/smb/client/connect.c
diff options
context:
space:
mode:
authorWinston Wen <wentao@uniontech.com>2023-07-24 05:10:57 +0300
committerSteve French <stfrench@microsoft.com>2023-07-25 08:31:24 +0300
commita43f95fdd39490f7b156fd126f1e90ec2d5553f1 (patch)
tree0c04f59c861af7936b5802ce40beec5d46badc58 /fs/smb/client/connect.c
parentc1ed39ec116272935528ca9b348b8ee79b0791da (diff)
downloadlinux-a43f95fdd39490f7b156fd126f1e90ec2d5553f1.tar.xz
cifs: fix charset issue in reconnection
We need to specify charset, like "iocharset=utf-8", in mount options for Chinese path if the nls_default don't support it, such as iso8859-1, the default value for CONFIG_NLS_DEFAULT. But now in reconnection the nls_default is used, instead of the one we specified and used in mount, and this can lead to mount failure. Signed-off-by: Winston Wen <wentao@uniontech.com> Reviewed-by: Paulo Alcantara <pc@manguebit.com> Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/smb/client/connect.c')
-rw-r--r--fs/smb/client/connect.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c
index 9280e253bf09..238538dde4e3 100644
--- a/fs/smb/client/connect.c
+++ b/fs/smb/client/connect.c
@@ -1842,6 +1842,10 @@ static int match_session(struct cifs_ses *ses, struct smb3_fs_context *ctx)
CIFS_MAX_PASSWORD_LEN))
return 0;
}
+
+ if (strcmp(ctx->local_nls->charset, ses->local_nls->charset))
+ return 0;
+
return 1;
}
@@ -2286,6 +2290,7 @@ cifs_get_smb_ses(struct TCP_Server_Info *server, struct smb3_fs_context *ctx)
ses->sectype = ctx->sectype;
ses->sign = ctx->sign;
+ ses->local_nls = load_nls(ctx->local_nls->charset);
/* add server as first channel */
spin_lock(&ses->chan_lock);