summaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifssmb.c
diff options
context:
space:
mode:
authorPavel Shilovsky <pshilov@microsoft.com>2019-01-17 16:18:38 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-11-06 13:05:35 +0100
commitee4d28a716e8872fb92baa79ce4f5b2fe2e77710 (patch)
treecb363f2971bf53cba509a4ea5f9eed6f146b166c /fs/cifs/cifssmb.c
parent2a2022688a91e2f25984c1f77579e642cc7bb64c (diff)
downloadlinux-stable-ee4d28a716e8872fb92baa79ce4f5b2fe2e77710.tar.gz
linux-stable-ee4d28a716e8872fb92baa79ce4f5b2fe2e77710.tar.bz2
linux-stable-ee4d28a716e8872fb92baa79ce4f5b2fe2e77710.zip
CIFS: Respect SMB2 hdr preamble size in read responses
[ Upstream commit bb1bccb60c2ebd9a6f895507d1d48d5ed773814e ] There are a couple places where we still account for 4 bytes in the beginning of SMB2 packet which is not true in the current code. Fix this to use a header preamble size where possible. Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs/cifs/cifssmb.c')
-rw-r--r--fs/cifs/cifssmb.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 86a54b809c48..8b9471904f67 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -1521,9 +1521,10 @@ cifs_readv_receive(struct TCP_Server_Info *server, struct mid_q_entry *mid)
/* set up first two iov for signature check and to get credits */
rdata->iov[0].iov_base = buf;
- rdata->iov[0].iov_len = 4;
- rdata->iov[1].iov_base = buf + 4;
- rdata->iov[1].iov_len = server->total_read - 4;
+ rdata->iov[0].iov_len = server->vals->header_preamble_size;
+ rdata->iov[1].iov_base = buf + server->vals->header_preamble_size;
+ rdata->iov[1].iov_len =
+ server->total_read - server->vals->header_preamble_size;
cifs_dbg(FYI, "0: iov_base=%p iov_len=%zu\n",
rdata->iov[0].iov_base, rdata->iov[0].iov_len);
cifs_dbg(FYI, "1: iov_base=%p iov_len=%zu\n",