aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/connect.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 8918f935bf07..52195bad5e67 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -568,27 +568,21 @@ dequeue_mid(struct mid_q_entry *mid, int malformed)
568 spin_unlock(&GlobalMid_Lock); 568 spin_unlock(&GlobalMid_Lock);
569} 569}
570 570
571static struct mid_q_entry * 571static void
572find_cifs_mid(struct TCP_Server_Info *server, struct smb_hdr *buf, 572handle_mid(struct mid_q_entry *mid, struct TCP_Server_Info *server,
573 int malformed) 573 struct smb_hdr *buf, int malformed)
574{ 574{
575 struct mid_q_entry *mid = NULL;
576
577 mid = find_mid(server, buf);
578 if (!mid)
579 return mid;
580
581 if (malformed == 0 && check2ndT2(buf) > 0) { 575 if (malformed == 0 && check2ndT2(buf) > 0) {
582 mid->multiRsp = true; 576 mid->multiRsp = true;
583 if (mid->resp_buf) { 577 if (mid->resp_buf) {
584 /* merge response - fix up 1st*/ 578 /* merge response - fix up 1st*/
585 malformed = coalesce_t2(buf, mid->resp_buf); 579 malformed = coalesce_t2(buf, mid->resp_buf);
586 if (malformed > 0) 580 if (malformed > 0)
587 return mid; 581 return;
588 582
589 /* All parts received or packet is malformed. */ 583 /* All parts received or packet is malformed. */
590 mid->multiEnd = true; 584 mid->multiEnd = true;
591 goto multi_t2_fnd; 585 return dequeue_mid(mid, malformed);
592 } 586 }
593 if (!server->large_buf) { 587 if (!server->large_buf) {
594 /*FIXME: switch to already allocated largebuf?*/ 588 /*FIXME: switch to already allocated largebuf?*/
@@ -599,7 +593,7 @@ find_cifs_mid(struct TCP_Server_Info *server, struct smb_hdr *buf,
599 mid->largeBuf = true; 593 mid->largeBuf = true;
600 server->bigbuf = NULL; 594 server->bigbuf = NULL;
601 } 595 }
602 return mid; 596 return;
603 } 597 }
604 mid->resp_buf = buf; 598 mid->resp_buf = buf;
605 mid->largeBuf = server->large_buf; 599 mid->largeBuf = server->large_buf;
@@ -611,9 +605,7 @@ find_cifs_mid(struct TCP_Server_Info *server, struct smb_hdr *buf,
611 else 605 else
612 server->smallbuf = NULL; 606 server->smallbuf = NULL;
613 } 607 }
614multi_t2_fnd:
615 dequeue_mid(mid, malformed); 608 dequeue_mid(mid, malformed);
616 return mid;
617} 609}
618 610
619static void clean_demultiplex_info(struct TCP_Server_Info *server) 611static void clean_demultiplex_info(struct TCP_Server_Info *server)
@@ -775,6 +767,8 @@ cifs_demultiplex_thread(void *p)
775 continue; 767 continue;
776 server->total_read += length; 768 server->total_read += length;
777 769
770 mid_entry = find_mid(server, smb_buffer);
771
778 if (pdu_length > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE - 4) { 772 if (pdu_length > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE - 4) {
779 cERROR(1, "SMB response too long (%u bytes)", 773 cERROR(1, "SMB response too long (%u bytes)",
780 pdu_length); 774 pdu_length);
@@ -819,8 +813,8 @@ cifs_demultiplex_thread(void *p)
819 813
820 server->lstrp = jiffies; 814 server->lstrp = jiffies;
821 815
822 mid_entry = find_cifs_mid(server, smb_buffer, length);
823 if (mid_entry != NULL) { 816 if (mid_entry != NULL) {
817 handle_mid(mid_entry, server, smb_buffer, length);
824 if (!mid_entry->multiRsp || mid_entry->multiEnd) 818 if (!mid_entry->multiRsp || mid_entry->multiEnd)
825 mid_entry->callback(mid_entry); 819 mid_entry->callback(mid_entry);
826 } else if (length != 0) { 820 } else if (length != 0) {