[PATCH] cifs: Fix broken SMB2_TRANSFORM header being sent

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx>
---
 fs/cifs/smb2ops.c | 8 ++++++++
 1 file changed, 8 insertions(+)

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])
-- 
2.17.1

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



[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux