CIFS: Fix too big maxBuf size for SMB3 mounts
SMB3 servers can respond with MaxTransactSize of more than 4M that can cause a memory allocation error returned from kmalloc in a lock codepath. Also the client doesn't support multicredit requests now and allows buffer sizes of 65536 bytes only. Set MaxTransactSize to this maximum supported value. Cc: stable@vger.kernel.org # 3.7+ Signed-off-by: Pavel Shilovsky <piastry@etersoft.ru> Acked-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <smfrench@gmail.com>
此提交包含在:
@@ -413,7 +413,9 @@ SMB2_negotiate(const unsigned int xid, struct cifs_ses *ses)
|
||||
|
||||
/* SMB2 only has an extended negflavor */
|
||||
server->negflavor = CIFS_NEGFLAVOR_EXTENDED;
|
||||
server->maxBuf = le32_to_cpu(rsp->MaxTransactSize);
|
||||
/* set it to the maximum buffer size value we can send with 1 credit */
|
||||
server->maxBuf = min_t(unsigned int, le32_to_cpu(rsp->MaxTransactSize),
|
||||
SMB2_MAX_BUFFER_SIZE);
|
||||
server->max_read = le32_to_cpu(rsp->MaxReadSize);
|
||||
server->max_write = le32_to_cpu(rsp->MaxWriteSize);
|
||||
/* BB Do we need to validate the SecurityMode? */
|
||||
|
新增問題並參考
封鎖使用者