aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/connect.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 6126fbeaecb6..ed969fd5f7cc 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -359,16 +359,20 @@ allocate_buffers(char **bigbuf, char **smallbuf, unsigned int size,
359} 359}
360 360
361static int 361static int
362read_from_socket(struct TCP_Server_Info *server, struct msghdr *smb_msg, 362read_from_socket(struct TCP_Server_Info *server,
363 struct kvec *iov, unsigned int to_read, 363 struct kvec *iov, unsigned int to_read,
364 unsigned int *ptotal_read, bool is_header_read) 364 unsigned int *ptotal_read, bool is_header_read)
365{ 365{
366 int length, rc = 0; 366 int length, rc = 0;
367 unsigned int total_read; 367 unsigned int total_read;
368 struct msghdr smb_msg;
368 char *buf = iov->iov_base; 369 char *buf = iov->iov_base;
369 370
371 smb_msg.msg_control = NULL;
372 smb_msg.msg_controllen = 0;
373
370 for (total_read = 0; total_read < to_read; total_read += length) { 374 for (total_read = 0; total_read < to_read; total_read += length) {
371 length = kernel_recvmsg(server->ssocket, smb_msg, iov, 1, 375 length = kernel_recvmsg(server->ssocket, &smb_msg, iov, 1,
372 to_read - total_read, 0); 376 to_read - total_read, 0);
373 if (server->tcpStatus == CifsExiting) { 377 if (server->tcpStatus == CifsExiting) {
374 /* then will exit */ 378 /* then will exit */
@@ -397,8 +401,6 @@ read_from_socket(struct TCP_Server_Info *server, struct msghdr *smb_msg,
397 iov->iov_base = (to_read - total_read) + 401 iov->iov_base = (to_read - total_read) +
398 buf; 402 buf;
399 iov->iov_len = to_read - total_read; 403 iov->iov_len = to_read - total_read;
400 smb_msg->msg_control = NULL;
401 smb_msg->msg_controllen = 0;
402 rc = 3; 404 rc = 3;
403 } else 405 } else
404 rc = 1; 406 rc = 1;
@@ -634,7 +636,6 @@ cifs_demultiplex_thread(void *p)
634 unsigned int pdu_length, total_read; 636 unsigned int pdu_length, total_read;
635 char *buf = NULL, *bigbuf = NULL, *smallbuf = NULL; 637 char *buf = NULL, *bigbuf = NULL, *smallbuf = NULL;
636 struct smb_hdr *smb_buffer = NULL; 638 struct smb_hdr *smb_buffer = NULL;
637 struct msghdr smb_msg;
638 struct kvec iov; 639 struct kvec iov;
639 struct task_struct *task_to_wake = NULL; 640 struct task_struct *task_to_wake = NULL;
640 struct mid_q_entry *mid_entry; 641 struct mid_q_entry *mid_entry;
@@ -665,8 +666,6 @@ cifs_demultiplex_thread(void *p)
665 buf = smallbuf; 666 buf = smallbuf;
666 iov.iov_base = buf; 667 iov.iov_base = buf;
667 iov.iov_len = 4; 668 iov.iov_len = 4;
668 smb_msg.msg_control = NULL;
669 smb_msg.msg_controllen = 0;
670 pdu_length = 4; /* enough to get RFC1001 header */ 669 pdu_length = 4; /* enough to get RFC1001 header */
671 670
672incomplete_rcv: 671incomplete_rcv:
@@ -681,7 +680,7 @@ incomplete_rcv:
681 continue; 680 continue;
682 } 681 }
683 682
684 rc = read_from_socket(server, &smb_msg, &iov, pdu_length, 683 rc = read_from_socket(server, &iov, pdu_length,
685 &total_read, true /* header read */); 684 &total_read, true /* header read */);
686 if (rc == 3) 685 if (rc == 3)
687 goto incomplete_rcv; 686 goto incomplete_rcv;
@@ -710,7 +709,7 @@ incomplete_rcv:
710 709
711 iov.iov_base = 4 + buf; 710 iov.iov_base = 4 + buf;
712 iov.iov_len = pdu_length; 711 iov.iov_len = pdu_length;
713 rc = read_from_socket(server, &smb_msg, &iov, pdu_length, 712 rc = read_from_socket(server, &iov, pdu_length,
714 &total_read, false); 713 &total_read, false);
715 if (rc == 2) 714 if (rc == 2)
716 break; 715 break;