aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYiqi Sun <sunyiqixm@gmail.com>2025-11-11 15:05:39 +0800
committerSteve French <stfrench@microsoft.com>2025-11-11 10:01:47 -0600
commited6612165b74f09db00ef0abaf9831895ab28b7f (patch)
tree0f67ad498d2c49771b6663262b714f3783acd040
parente8c73eb7db0a498cd4b22d2819e6ab1a6f506bd6 (diff)
downloadlinux-ed6612165b74f09db00ef0abaf9831895ab28b7f.tar.gz
smb: fix invalid username check in smb3_fs_context_parse_param()
Since the maximum return value of strnlen(..., CIFS_MAX_USERNAME_LEN) is CIFS_MAX_USERNAME_LEN, length check in smb3_fs_context_parse_param() is always FALSE and invalid. Fix the comparison in if statement. Signed-off-by: Yiqi Sun <sunyiqixm@gmail.com> Signed-off-by: Steve French <stfrench@microsoft.com>
-rw-r--r--fs/smb/client/fs_context.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/smb/client/fs_context.c b/fs/smb/client/fs_context.c
index c2d5bb23040cf2..0f894d09157b91 100644
--- a/fs/smb/client/fs_context.c
+++ b/fs/smb/client/fs_context.c
@@ -1470,7 +1470,7 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
break;
}
- if (strnlen(param->string, CIFS_MAX_USERNAME_LEN) >
+ if (strnlen(param->string, CIFS_MAX_USERNAME_LEN) ==
CIFS_MAX_USERNAME_LEN) {
pr_warn("username too long\n");
goto cifs_parse_mount_err;