Skip to content

Commit c22551c

Browse files
sunichigregkh
authored andcommitted
smb: fix invalid username check in smb3_fs_context_parse_param()
[ Upstream commit ed66121 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent fcd5786 commit c22551c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

fs/smb/client/fs_context.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1472,7 +1472,7 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
14721472
break;
14731473
}
14741474

1475-
if (strnlen(param->string, CIFS_MAX_USERNAME_LEN) >
1475+
if (strnlen(param->string, CIFS_MAX_USERNAME_LEN) ==
14761476
CIFS_MAX_USERNAME_LEN) {
14771477
pr_warn("username too long\n");
14781478
goto cifs_parse_mount_err;

0 commit comments

Comments
 (0)