Updated patch. Thanks ----- Original Message ----- From: "Steve French" <smfrench@xxxxxxxxx> To: "Ronnie Sahlberg" <lsahlber@xxxxxxxxxx> Cc: "CIFS" <linux-cifs@xxxxxxxxxxxxxxx> Sent: Wednesday, 1 August, 2018 5:19:36 PM Subject: Re: [PATCH 0/8] cifs compounding I have merged the first three tentatively, but did a little cleanup of scripts/checkpatch warnings (see attached lightly updated patches). For patch four (update receive encrypted standard) I noticed some endian errors - can you fix them (when I built them I got these sparse warnings) CHECK /home/sfrench/cifs-2.6/fs/cifs/smb2ops.c /home/sfrench/cifs-2.6/fs/cifs/smb2ops.c:3075:66: warning: restricted __le32 degrades to integer /home/sfrench/cifs-2.6/fs/cifs/smb2ops.c:3076:49: warning: restricted __le32 degrades to integer /home/sfrench/cifs-2.6/fs/cifs/smb2ops.c:3079:68: warning: restricted __le32 degrades to integer /home/sfrench/cifs-2.6/fs/cifs/smb2ops.c:3080:49: warning: restricted __le32 degrades to integer /home/sfrench/cifs-2.6/fs/cifs/smb2ops.c:3101:28: warning: invalid assignment: -= /home/sfrench/cifs-2.6/fs/cifs/smb2ops.c:3101:28: left side has type unsigned int /home/sfrench/cifs-2.6/fs/cifs/smb2ops.c:3101:28: right side has type restricted __le32 /home/sfrench/cifs-2.6/fs/cifs/smb2ops.c:3108:28: warning: restricted __le32 degrades to integer Attached are the lightly updated versions of the patches that reduce the checkpatch warnings - but can you cleanup the endian errors in patch 4. On Tue, Jul 31, 2018 at 6:26 PM Ronnie Sahlberg <lsahlber@xxxxxxxxxx> wrote: > > Steve, All > > An updated patch series based on Pavels feedback. > -- Thanks, Steve
From 26272e9e6982d1357495b425098587e7bf63f72f Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg <lsahlber@xxxxxxxxxx> Date: Wed, 1 Aug 2018 09:26:14 +1000 Subject: [PATCH 4/4] cifs: update receive_encrypted_standard to handle compounded responses Signed-off-by: Ronnie Sahlberg <lsahlber@xxxxxxxxxx> --- fs/cifs/smb2ops.c | 41 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index ebc13ebebddf..be574f5cf38c 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c @@ -2944,11 +2944,14 @@ static int receive_encrypted_standard(struct TCP_Server_Info *server, struct mid_q_entry **mid) { - int length; + int ret, length; char *buf = server->smallbuf; + struct smb2_sync_hdr *shdr; unsigned int pdu_length = server->pdu_size; unsigned int buf_size; struct mid_q_entry *mid_entry; + int next_is_large; + char *next_buffer = NULL; /* switch to large buffer if too big for a small one */ if (pdu_length > MAX_CIFS_SMALL_BUFFER_SIZE) { @@ -2969,6 +2972,23 @@ receive_encrypted_standard(struct TCP_Server_Info *server, if (length) return length; + next_is_large = server->large_buf; + one_more: + shdr = (struct smb2_sync_hdr *)buf; + if (shdr->NextCommand) { + if (next_is_large) { + next_buffer = (char *)cifs_buf_get(); + memcpy(next_buffer, + server->bigbuf + le32_to_cpu(shdr->NextCommand), + pdu_length - le32_to_cpu(shdr->NextCommand)); + } else { + next_buffer = (char *)cifs_small_buf_get(); + memcpy(next_buffer, server->smallbuf + + le32_to_cpu(shdr->NextCommand), + pdu_length - le32_to_cpu(shdr->NextCommand)); + } + } + mid_entry = smb2_find_mid(server, buf); if (mid_entry == NULL) cifs_dbg(FYI, "mid not found\n"); @@ -2976,13 +2996,28 @@ receive_encrypted_standard(struct TCP_Server_Info *server, cifs_dbg(FYI, "mid found\n"); mid_entry->decrypted = true; } + mid_entry->resp_buf_size = server->pdu_size; *mid = mid_entry; if (mid_entry && mid_entry->handle) - return mid_entry->handle(server, mid_entry); + ret = mid_entry->handle(server, mid_entry); + else + ret = cifs_handle_standard(server, mid_entry); + + if (ret == 0 && shdr->NextCommand) { + pdu_length -= le32_to_cpu(shdr->NextCommand); + server->large_buf = next_is_large; + if (next_is_large) + server->bigbuf = next_buffer; + else + server->smallbuf = next_buffer; + + buf += le32_to_cpu(shdr->NextCommand); + goto one_more; + } - return cifs_handle_standard(server, mid_entry); + return ret; } static int -- 2.13.3