Commit 97754680 authored by Ronnie Sahlberg's avatar Ronnie Sahlberg Committed by Steve French

cifs: remove rfc1002 header from smb2_ioctl_req

Signed-off-by: default avatarRonnie Sahlberg <lsahlber@redhat.com>
Reviewed-by: default avatarAurelien Aptel <aaptel@suse.com>
Signed-off-by: default avatarSteve French <smfrench@gmail.com>
Acked-by: default avatarPavel Shilovsky <pshilov@microsoft.com>
parent afcccefd
...@@ -1912,6 +1912,7 @@ SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid, ...@@ -1912,6 +1912,7 @@ SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid,
int n_iov; int n_iov;
int rc = 0; int rc = 0;
int flags = 0; int flags = 0;
unsigned int total_len;
cifs_dbg(FYI, "SMB2 IOCTL\n"); cifs_dbg(FYI, "SMB2 IOCTL\n");
...@@ -1930,7 +1931,7 @@ SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid, ...@@ -1930,7 +1931,7 @@ SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid,
if (!ses || !(ses->server)) if (!ses || !(ses->server))
return -EIO; return -EIO;
rc = small_smb2_init(SMB2_IOCTL, tcon, (void **) &req); rc = smb2_plain_req_init(SMB2_IOCTL, tcon, (void **) &req, &total_len);
if (rc) if (rc)
return rc; return rc;
...@@ -1941,8 +1942,8 @@ SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid, ...@@ -1941,8 +1942,8 @@ SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid,
} }
cifs_dbg(FYI, "replacing tid 0x%x with IPC tid 0x%x\n", cifs_dbg(FYI, "replacing tid 0x%x with IPC tid 0x%x\n",
req->hdr.sync_hdr.TreeId, ses->ipc_tid); req->sync_hdr.TreeId, ses->ipc_tid);
req->hdr.sync_hdr.TreeId = ses->ipc_tid; req->sync_hdr.TreeId = ses->ipc_tid;
} }
if (encryption_required(tcon)) if (encryption_required(tcon))
flags |= CIFS_TRANSFORM_REQ; flags |= CIFS_TRANSFORM_REQ;
...@@ -1955,7 +1956,7 @@ SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid, ...@@ -1955,7 +1956,7 @@ SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid,
req->InputCount = cpu_to_le32(indatalen); req->InputCount = cpu_to_le32(indatalen);
/* do not set InputOffset if no input data */ /* do not set InputOffset if no input data */
req->InputOffset = req->InputOffset =
cpu_to_le32(offsetof(struct smb2_ioctl_req, Buffer) - 4); cpu_to_le32(offsetof(struct smb2_ioctl_req, Buffer));
iov[1].iov_base = in_data; iov[1].iov_base = in_data;
iov[1].iov_len = indatalen; iov[1].iov_len = indatalen;
n_iov = 2; n_iov = 2;
...@@ -1990,21 +1991,20 @@ SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid, ...@@ -1990,21 +1991,20 @@ SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid,
* but if input data passed to ioctl, we do not * but if input data passed to ioctl, we do not
* want to double count this, so we do not send * want to double count this, so we do not send
* the dummy one byte of data in iovec[0] if sending * the dummy one byte of data in iovec[0] if sending
* input data (in iovec[1]). We also must add 4 bytes * input data (in iovec[1]).
* in first iovec to allow for rfc1002 length field.
*/ */
if (indatalen) { if (indatalen) {
iov[0].iov_len = get_rfc1002_length(req) + 4 - 1; iov[0].iov_len = total_len - 1;
inc_rfc1001_len(req, indatalen - 1);
} else } else
iov[0].iov_len = get_rfc1002_length(req) + 4; iov[0].iov_len = total_len;
/* validate negotiate request must be signed - see MS-SMB2 3.2.5.5 */ /* validate negotiate request must be signed - see MS-SMB2 3.2.5.5 */
if (opcode == FSCTL_VALIDATE_NEGOTIATE_INFO) if (opcode == FSCTL_VALIDATE_NEGOTIATE_INFO)
req->hdr.sync_hdr.Flags |= SMB2_FLAGS_SIGNED; req->sync_hdr.Flags |= SMB2_FLAGS_SIGNED;
rc = SendReceive2(xid, ses, iov, n_iov, &resp_buftype, flags, &rsp_iov); rc = smb2_send_recv(xid, ses, iov, n_iov, &resp_buftype, flags,
&rsp_iov);
cifs_small_buf_release(req); cifs_small_buf_release(req);
rsp = (struct smb2_ioctl_rsp *)rsp_iov.iov_base; rsp = (struct smb2_ioctl_rsp *)rsp_iov.iov_base;
......
...@@ -753,7 +753,7 @@ struct duplicate_extents_to_file { ...@@ -753,7 +753,7 @@ struct duplicate_extents_to_file {
} __packed; } __packed;
struct smb2_ioctl_req { struct smb2_ioctl_req {
struct smb2_hdr hdr; struct smb2_sync_hdr sync_hdr;
__le16 StructureSize; /* Must be 57 */ __le16 StructureSize; /* Must be 57 */
__u16 Reserved; __u16 Reserved;
__le32 CtlCode; __le32 CtlCode;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment