]> git.baikalelectronics.ru Git - kernel.git/commit
cifs: Use correct packet length in SMB2_TRANSFORM header
authorPaulo Alcantara <paulo@paulo.ac>
Fri, 15 Jun 2018 13:22:44 +0000 (10:22 -0300)
committerSteve French <stfrench@microsoft.com>
Sat, 16 Jun 2018 00:17:40 +0000 (19:17 -0500)
commit021f4902ed7b454d4534c7d945eb4f5af3e6c66b
tree7a4480897728404002b2a388f6f4245c902e90b4
parentf27b6013aef6b1a40c3919c90b773faf4cc8be3d
cifs: Use correct packet length in SMB2_TRANSFORM header

In smb3_init_transform_rq(), 'orig_len' was only counting the request
length, but forgot to count any data pages in the request.

Writing or creating files with the 'seal' mount option was broken.

In addition, do some code refactoring by exporting smb2_rqst_len() to
calculate the appropriate packet size and avoid duplicating the same
calculation all over the code.

The start of the io vector is either the rfc1002 length (4 bytes) or a
SMB2 header which is always > 4. Use this fact to check and skip the
rfc1002 length if requested.

Signed-off-by: Paulo Alcantara <palcantara@suse.de>
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifs/smb2ops.c
fs/cifs/smb2proto.h
fs/cifs/smbdirect.c
fs/cifs/transport.c