CIFS: Respect SMB2 hdr preamble size in read responses
authorPavel Shilovsky <pshilov@microsoft.com>
Fri, 18 Jan 2019 00:18:38 +0000 (16:18 -0800)
committerSteve French <stfrench@microsoft.com>
Tue, 5 Mar 2019 02:06:39 +0000 (20:06 -0600)
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>
fs/cifs/cifssmb.c
fs/cifs/smb2ops.c

index 683c7c9..3f4e40a 100644 (file)
@@ -1612,9 +1612,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",
index 5adfe68..7291d82 100644 (file)
@@ -3244,10 +3244,10 @@ handle_read_data(struct TCP_Server_Info *server, struct mid_q_entry *mid,
 
        /* set up first two iov to get credits */
        rdata->iov[0].iov_base = buf;
-       rdata->iov[0].iov_len = 4;
-       rdata->iov[1].iov_base = buf + 4;
+       rdata->iov[0].iov_len = 0;
+       rdata->iov[1].iov_base = buf;
        rdata->iov[1].iov_len =
-               min_t(unsigned int, buf_len, server->vals->read_rsp_size) - 4;
+               min_t(unsigned int, buf_len, server->vals->read_rsp_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",