cifs: remove rfc1002 header from smb2_set_info_req
authorRonnie Sahlberg <lsahlber@redhat.com>
Mon, 20 Nov 2017 00:24:44 +0000 (11:24 +1100)
committerSteve French <smfrench@gmail.com>
Thu, 25 Jan 2018 01:49:05 +0000 (19:49 -0600)
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Steve French <smfrench@gmail.com>
Acked-by: Pavel Shilovsky <pshilov@microsoft.com>
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
fs/cifs/smb2pdu.c
fs/cifs/smb2pdu.h

index 9cce02d20576751be3052f9c138cf957009e81c9..d9a0fabe61d1bdad7403692fbdb63e086921fec5 100644 (file)
@@ -3119,6 +3119,7 @@ send_set_info(const unsigned int xid, struct cifs_tcon *tcon,
        unsigned int i;
        struct cifs_ses *ses = tcon->ses;
        int flags = 0;
+       unsigned int total_len;
 
        if (!ses || !(ses->server))
                return -EIO;
@@ -3130,7 +3131,7 @@ send_set_info(const unsigned int xid, struct cifs_tcon *tcon,
        if (!iov)
                return -ENOMEM;
 
-       rc = small_smb2_init(SMB2_SET_INFO, tcon, (void **) &req);
+       rc = smb2_plain_req_init(SMB2_SET_INFO, tcon, (void **) &req, &total_len);
        if (rc) {
                kfree(iov);
                return rc;
@@ -3139,7 +3140,7 @@ send_set_info(const unsigned int xid, struct cifs_tcon *tcon,
        if (encryption_required(tcon))
                flags |= CIFS_TRANSFORM_REQ;
 
-       req->hdr.sync_hdr.ProcessId = cpu_to_le32(pid);
+       req->sync_hdr.ProcessId = cpu_to_le32(pid);
 
        req->InfoType = info_type;
        req->FileInfoClass = info_class;
@@ -3147,27 +3148,25 @@ send_set_info(const unsigned int xid, struct cifs_tcon *tcon,
        req->VolatileFileId = volatile_fid;
        req->AdditionalInformation = cpu_to_le32(additional_info);
 
-       /* 4 for RFC1001 length and 1 for Buffer */
        req->BufferOffset =
-                       cpu_to_le16(sizeof(struct smb2_set_info_req) - 1 - 4);
+                       cpu_to_le16(sizeof(struct smb2_set_info_req) - 1);
        req->BufferLength = cpu_to_le32(*size);
 
-       inc_rfc1001_len(req, *size - 1 /* Buffer */);
-
        memcpy(req->Buffer, *data, *size);
+       total_len += *size;
 
        iov[0].iov_base = (char *)req;
-       /* 4 for RFC1001 length */
-       iov[0].iov_len = get_rfc1002_length(req) + 4;
+       /* 1 for Buffer */
+       iov[0].iov_len = total_len - 1;
 
        for (i = 1; i < num; i++) {
-               inc_rfc1001_len(req, size[i]);
                le32_add_cpu(&req->BufferLength, size[i]);
                iov[i].iov_base = (char *)data[i];
                iov[i].iov_len = size[i];
        }
 
-       rc = SendReceive2(xid, ses, iov, num, &resp_buftype, flags, &rsp_iov);
+       rc = smb2_send_recv(xid, ses, iov, num, &resp_buftype, flags,
+                           &rsp_iov);
        cifs_small_buf_release(req);
        rsp = (struct smb2_set_info_rsp *)rsp_iov.iov_base;
 
index 3c856f058be7aa12640e6180ffa60492266890f0..831745a0a4965b90f74b92cd78a4fb6a351e5414 100644 (file)
@@ -1013,7 +1013,7 @@ struct smb2_query_info_rsp {
 } __packed;
 
 struct smb2_set_info_req {
-       struct smb2_hdr hdr;
+       struct smb2_sync_hdr sync_hdr;
        __le16 StructureSize; /* Must be 33 */
        __u8   InfoType;
        __u8   FileInfoClass;