diff options
author | Namjae Jeon <linkinjeon@kernel.org> | 2023-02-08 09:50:46 +0900 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2023-02-15 00:04:38 -0600 |
commit | 8f8c43b125882ac14372f8dca0c8e50a59e78d79 (patch) | |
tree | 897b6478abf354931719fd5836cfbbab33aaa9df /fs/ksmbd | |
parent | 63f09a9986eb58578ed6ad0e27a6e2c54e49f797 (diff) | |
download | linux-8f8c43b125882ac14372f8dca0c8e50a59e78d79.tar.gz linux-8f8c43b125882ac14372f8dca0c8e50a59e78d79.tar.bz2 linux-8f8c43b125882ac14372f8dca0c8e50a59e78d79.zip |
ksmbd: fix wrong data area length for smb2 lock request
When turning debug mode on, The following error message from
ksmbd_smb2_check_message() is coming.
ksmbd: cli req padded more than expected. Length 112 not 88 for cmd:10 mid:14
data area length calculation for smb2 lock request in smb2_get_data_area_len() is
incorrect.
Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3")
Cc: stable@vger.kernel.org
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/ksmbd')
-rw-r--r-- | fs/ksmbd/smb2misc.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/fs/ksmbd/smb2misc.c b/fs/ksmbd/smb2misc.c index 6e25ace36568..a717aa9b4af8 100644 --- a/fs/ksmbd/smb2misc.c +++ b/fs/ksmbd/smb2misc.c @@ -149,15 +149,11 @@ static int smb2_get_data_area_len(unsigned int *off, unsigned int *len, break; case SMB2_LOCK: { - int lock_count; + unsigned short lock_count; - /* - * smb2_lock request size is 48 included single - * smb2_lock_element structure size. - */ - lock_count = le16_to_cpu(((struct smb2_lock_req *)hdr)->LockCount) - 1; + lock_count = le16_to_cpu(((struct smb2_lock_req *)hdr)->LockCount); if (lock_count > 0) { - *off = __SMB2_HEADER_STRUCTURE_SIZE + 48; + *off = offsetof(struct smb2_lock_req, locks); *len = sizeof(struct smb2_lock_element) * lock_count; } break; |