cifs: untangle server->maxBuf and CIFSMaxBufSize
[pandora-kernel.git] / fs / cifs / sess.c
index d3e6196..c7d80e2 100644 (file)
@@ -124,7 +124,9 @@ static __u32 cifs_ssetup_hdr(struct cifs_ses *ses, SESSION_SETUP_ANDX *pSMB)
        /*      that we use in next few lines                               */
        /* Note that header is initialized to zero in header_assemble */
        pSMB->req.AndXCommand = 0xFF;
-       pSMB->req.MaxBufferSize = cpu_to_le16(ses->server->maxBuf);
+       pSMB->req.MaxBufferSize = cpu_to_le16(min_t(u32,
+                                       CIFSMaxBufSize + MAX_CIFS_HDR_SIZE - 4,
+                                       USHRT_MAX));
        pSMB->req.MaxMpxCount = cpu_to_le16(ses->server->maxReq);
        pSMB->req.VcNumber = get_next_vcnum(ses);