diff mbox

cifs: Fix broken SMB2_TRANSFORM header being sent

Message ID 20180615133544.7514-1-paulo@paulo.ac (mailing list archive)
State New, archived
Headers show

Commit Message

Paulo Alcantara (SUSE) June 15, 2018, 1:35 p.m. UTC
In smb3_init_transform_rq(), 'orig_len' was only counting the request
length, but forgot to also include the number of bytes of the data being
written.

That said, writing or creating files with the 'seal' mount point was
broken.

Signed-off-by: Paulo Alcantara <palcantara@suse.de>
---
 fs/cifs/smb2ops.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Paulo Alcantara (SUSE) June 15, 2018, 1:41 p.m. UTC | #1
Paulo Alcantara <paulo@paulo.ac> writes:

> In smb3_init_transform_rq(), 'orig_len' was only counting the request
> length, but forgot to also include the number of bytes of the data being
> written.
>
> That said, writing or creating files with the 'seal' mount point was
> broken.
>
> Signed-off-by: Paulo Alcantara <palcantara@suse.de>
> ---
>  fs/cifs/smb2ops.c | 8 ++++++++
>  1 file changed, 8 insertions(+)

Please, ignore this patch. Just found a problem and I'll send another
shortly.

Paulo
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index badcfb2f3c22..ea198134fb48 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -2502,6 +2502,14 @@  smb3_init_transform_rq(struct TCP_Server_Info *server, struct smb_rqst *new_rq,
 	for (i = 0; i < old_rq->rq_nvec; i++)
 		orig_len += old_rq->rq_iov[i].iov_len;
 
+	if (old_rq->rq_npages) {
+		orig_len += old_rq->rq_tailsz;
+	} else {
+		orig_len += old_rq->rq_pagesz * (old_rq->rq_npages - 1) -
+			old_rq->rq_offset;
+		orig_len += old_rq->rq_tailsz;
+	}
+
 	for (i = 0; i < npages; i++) {
 		pages[i] = alloc_page(GFP_KERNEL|__GFP_HIGHMEM);
 		if (!pages[i])