From: Yiqi Sun Date: Tue, 11 Nov 2025 07:05:39 +0000 (+0800) Subject: smb: fix invalid username check in smb3_fs_context_parse_param() X-Git-Tag: v6.12.62~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ef9b1e6b8f90282b098a29442639b7759be1374b;p=thirdparty%2Fkernel%2Fstable.git smb: fix invalid username check in smb3_fs_context_parse_param() [ Upstream commit ed6612165b74f09db00ef0abaf9831895ab28b7f ] 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 Signed-off-by: Steve French Signed-off-by: Sasha Levin --- diff --git a/fs/smb/client/fs_context.c b/fs/smb/client/fs_context.c index 9a4492106c25..17133adfe798 100644 --- a/fs/smb/client/fs_context.c +++ b/fs/smb/client/fs_context.c @@ -1415,7 +1415,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;