Skip to content

Commit 8f8c43b

Browse files
namjaejeonsmfrench
authored andcommitted
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: e2f3448 ("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>
1 parent 63f09a9 commit 8f8c43b

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

fs/ksmbd/smb2misc.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -149,15 +149,11 @@ static int smb2_get_data_area_len(unsigned int *off, unsigned int *len,
149149
break;
150150
case SMB2_LOCK:
151151
{
152-
int lock_count;
152+
unsigned short lock_count;
153153

154-
/*
155-
* smb2_lock request size is 48 included single
156-
* smb2_lock_element structure size.
157-
*/
158-
lock_count = le16_to_cpu(((struct smb2_lock_req *)hdr)->LockCount) - 1;
154+
lock_count = le16_to_cpu(((struct smb2_lock_req *)hdr)->LockCount);
159155
if (lock_count > 0) {
160-
*off = __SMB2_HEADER_STRUCTURE_SIZE + 48;
156+
*off = offsetof(struct smb2_lock_req, locks);
161157
*len = sizeof(struct smb2_lock_element) * lock_count;
162158
}
163159
break;

0 commit comments

Comments
 (0)