diff options
Diffstat (limited to 'fs/cifs/cifssmb.c')
-rw-r--r-- | fs/cifs/cifssmb.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 8b7794c31591..cd66b76e3282 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -458,7 +458,10 @@ CIFSSMBNegotiate(unsigned int xid, struct cifs_ses *ses) | |||
458 | goto neg_err_exit; | 458 | goto neg_err_exit; |
459 | } | 459 | } |
460 | server->sec_mode = (__u8)le16_to_cpu(rsp->SecurityMode); | 460 | server->sec_mode = (__u8)le16_to_cpu(rsp->SecurityMode); |
461 | server->maxReq = le16_to_cpu(rsp->MaxMpxCount); | 461 | server->maxReq = min_t(unsigned int, |
462 | le16_to_cpu(rsp->MaxMpxCount), | ||
463 | cifs_max_pending); | ||
464 | server->oplocks = server->maxReq > 1 ? enable_oplocks : false; | ||
462 | server->maxBuf = le16_to_cpu(rsp->MaxBufSize); | 465 | server->maxBuf = le16_to_cpu(rsp->MaxBufSize); |
463 | server->max_vcs = le16_to_cpu(rsp->MaxNumberVcs); | 466 | server->max_vcs = le16_to_cpu(rsp->MaxNumberVcs); |
464 | /* even though we do not use raw we might as well set this | 467 | /* even though we do not use raw we might as well set this |
@@ -564,7 +567,9 @@ CIFSSMBNegotiate(unsigned int xid, struct cifs_ses *ses) | |||
564 | 567 | ||
565 | /* one byte, so no need to convert this or EncryptionKeyLen from | 568 | /* one byte, so no need to convert this or EncryptionKeyLen from |
566 | little endian */ | 569 | little endian */ |
567 | server->maxReq = le16_to_cpu(pSMBr->MaxMpxCount); | 570 | server->maxReq = min_t(unsigned int, le16_to_cpu(pSMBr->MaxMpxCount), |
571 | cifs_max_pending); | ||
572 | server->oplocks = server->maxReq > 1 ? enable_oplocks : false; | ||
568 | /* probably no need to store and check maxvcs */ | 573 | /* probably no need to store and check maxvcs */ |
569 | server->maxBuf = le32_to_cpu(pSMBr->MaxBufferSize); | 574 | server->maxBuf = le32_to_cpu(pSMBr->MaxBufferSize); |
570 | server->max_rw = le32_to_cpu(pSMBr->MaxRawSize); | 575 | server->max_rw = le32_to_cpu(pSMBr->MaxRawSize); |