Re: [PATCH 2/2] cifs: limit amount of data we request for xattrs to CIFSMaxBufSize

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

 



ср, 23 янв. 2019 г. в 22:19, Ronnie Sahlberg <lsahlber@xxxxxxxxxx>:
>
> or else we might trigger a session reconnect.
>
> Signed-off-by: Ronnie Sahlberg <lsahlber@xxxxxxxxxx>
> ---
>  fs/cifs/smb2ops.c | 2 +-
>  fs/cifs/smb2pdu.h | 2 --
>  2 files changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
> index 34f621fe6dc0..32f19a97c750 100644
> --- a/fs/cifs/smb2ops.c
> +++ b/fs/cifs/smb2ops.c
> @@ -905,7 +905,7 @@ smb2_query_eas(const unsigned int xid, struct cifs_tcon *tcon,
>                                       FILE_READ_EA,
>                                       FILE_FULL_EA_INFORMATION,
>                                       SMB2_O_INFO_FILE,
> -                                     SMB2_MAX_EA_BUF,
> +                                     CIFSMaxBufSize,

This won't work with encryption. Today we allocate server->bigbuf of
CIFSMaxBufSize (16k) + MAX_SMB2_HDR_SIZE. The MAX_SMB2_HDR_SIZE is "4
len + 52 transform hdr + 64 hdr + 56 create rsp" currently. To query
EAs you need to send open + query + close. So, if you want EAs to be
16k, you need to fix MAX_SMB2_HDR_SIZE to be big enough, so it can fit
transform + 2 open + all create contexts + MAX_PATH * 2 + query info +
close which is 52 (transform) + 64*3 (3 headers) + 89 (open) + 520
(path) + 5 * ~30 (5 create contexts) + 9 (query info) + 60 (close) ~~
1100.

We have been already using MAX_HEADER_SIZE() + CIFSMaxBufSize in some
calculations in demultiplex thread and encryption functions, let's do
two fixes:

1) fix MAX_SMB2_HDR_SIZE to be 52 (transform header) + 64 (hdr) + 89
(right create rsp) - long-term minor bug.
2) fix smb2_query_eas() to pass (CIFSMaxBufSize - MAX_SMB2_OPEN_SIZE -
MAX_SMB2_CLOSE_SIZE), where
MAX_SMB2_OPEN_SIZE is 64 (hdr) + 89 (create rsp) + 520 (path) + 150
(contexts) and
MAX_SMB2_CLOSE_SIZE is 64 + 60.

--
Best regards,
Pavel Shilovsky




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

  Powered by Linux