diff options
Diffstat (limited to 'fs/cifs/transport.c')
-rw-r--r-- | fs/cifs/transport.c | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c index 746bc9405db1..7ed32b3cb781 100644 --- a/fs/cifs/transport.c +++ b/fs/cifs/transport.c | |||
@@ -55,7 +55,7 @@ AllocMidQEntry(const struct smb_hdr *smb_buffer, struct cifsSesInfo *ses) | |||
55 | if (temp == NULL) | 55 | if (temp == NULL) |
56 | return temp; | 56 | return temp; |
57 | else { | 57 | else { |
58 | memset(temp, 0, sizeof (struct mid_q_entry)); | 58 | memset(temp, 0, sizeof(struct mid_q_entry)); |
59 | temp->mid = smb_buffer->Mid; /* always LE */ | 59 | temp->mid = smb_buffer->Mid; /* always LE */ |
60 | temp->pid = current->pid; | 60 | temp->pid = current->pid; |
61 | temp->command = smb_buffer->Command; | 61 | temp->command = smb_buffer->Command; |
@@ -158,7 +158,7 @@ smb_send(struct socket *ssocket, struct smb_hdr *smb_buffer, | |||
158 | iov.iov_len = len; | 158 | iov.iov_len = len; |
159 | 159 | ||
160 | smb_msg.msg_name = sin; | 160 | smb_msg.msg_name = sin; |
161 | smb_msg.msg_namelen = sizeof (struct sockaddr); | 161 | smb_msg.msg_namelen = sizeof(struct sockaddr); |
162 | smb_msg.msg_control = NULL; | 162 | smb_msg.msg_control = NULL; |
163 | smb_msg.msg_controllen = 0; | 163 | smb_msg.msg_controllen = 0; |
164 | smb_msg.msg_flags = MSG_DONTWAIT + MSG_NOSIGNAL; /* BB add more flags?*/ | 164 | smb_msg.msg_flags = MSG_DONTWAIT + MSG_NOSIGNAL; /* BB add more flags?*/ |
@@ -228,7 +228,7 @@ smb_send2(struct socket *ssocket, struct kvec *iov, int n_vec, | |||
228 | return -ENOTSOCK; /* BB eventually add reconnect code here */ | 228 | return -ENOTSOCK; /* BB eventually add reconnect code here */ |
229 | 229 | ||
230 | smb_msg.msg_name = sin; | 230 | smb_msg.msg_name = sin; |
231 | smb_msg.msg_namelen = sizeof (struct sockaddr); | 231 | smb_msg.msg_namelen = sizeof(struct sockaddr); |
232 | smb_msg.msg_control = NULL; | 232 | smb_msg.msg_control = NULL; |
233 | smb_msg.msg_controllen = 0; | 233 | smb_msg.msg_controllen = 0; |
234 | smb_msg.msg_flags = MSG_DONTWAIT + MSG_NOSIGNAL; /* BB add more flags?*/ | 234 | smb_msg.msg_flags = MSG_DONTWAIT + MSG_NOSIGNAL; /* BB add more flags?*/ |
@@ -363,9 +363,8 @@ static int allocate_mid(struct cifsSesInfo *ses, struct smb_hdr *in_buf, | |||
363 | } /* else ok - we are setting up session */ | 363 | } /* else ok - we are setting up session */ |
364 | } | 364 | } |
365 | *ppmidQ = AllocMidQEntry(in_buf, ses); | 365 | *ppmidQ = AllocMidQEntry(in_buf, ses); |
366 | if (*ppmidQ == NULL) { | 366 | if (*ppmidQ == NULL) |
367 | return -ENOMEM; | 367 | return -ENOMEM; |
368 | } | ||
369 | return 0; | 368 | return 0; |
370 | } | 369 | } |
371 | 370 | ||
@@ -419,7 +418,7 @@ static int wait_for_response(struct cifsSesInfo *ses, | |||
419 | int | 418 | int |
420 | SendReceive2(const unsigned int xid, struct cifsSesInfo *ses, | 419 | SendReceive2(const unsigned int xid, struct cifsSesInfo *ses, |
421 | struct kvec *iov, int n_vec, int *pRespBufType /* ret */, | 420 | struct kvec *iov, int n_vec, int *pRespBufType /* ret */, |
422 | const int long_op) | 421 | const int long_op, const int logError) |
423 | { | 422 | { |
424 | int rc = 0; | 423 | int rc = 0; |
425 | unsigned int receive_len; | 424 | unsigned int receive_len; |
@@ -465,7 +464,6 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses, | |||
465 | wake_up(&ses->server->request_q); | 464 | wake_up(&ses->server->request_q); |
466 | return rc; | 465 | return rc; |
467 | } | 466 | } |
468 | |||
469 | rc = cifs_sign_smb2(iov, n_vec, ses->server, &midQ->sequence_number); | 467 | rc = cifs_sign_smb2(iov, n_vec, ses->server, &midQ->sequence_number); |
470 | 468 | ||
471 | midQ->midState = MID_REQUEST_SUBMITTED; | 469 | midQ->midState = MID_REQUEST_SUBMITTED; |
@@ -568,13 +566,11 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses, | |||
568 | } | 566 | } |
569 | 567 | ||
570 | /* BB special case reconnect tid and uid here? */ | 568 | /* BB special case reconnect tid and uid here? */ |
571 | /* BB special case Errbadpassword and pwdexpired here */ | 569 | rc = map_smb_to_linux_error(midQ->resp_buf, logError); |
572 | rc = map_smb_to_linux_error(midQ->resp_buf); | ||
573 | 570 | ||
574 | /* convert ByteCount if necessary */ | 571 | /* convert ByteCount if necessary */ |
575 | if (receive_len >= | 572 | if (receive_len >= sizeof(struct smb_hdr) - 4 |
576 | sizeof (struct smb_hdr) - | 573 | /* do not count RFC1001 header */ + |
577 | 4 /* do not count RFC1001 header */ + | ||
578 | (2 * midQ->resp_buf->WordCount) + 2 /* bcc */ ) | 574 | (2 * midQ->resp_buf->WordCount) + 2 /* bcc */ ) |
579 | BCC(midQ->resp_buf) = | 575 | BCC(midQ->resp_buf) = |
580 | le16_to_cpu(BCC_LE(midQ->resp_buf)); | 576 | le16_to_cpu(BCC_LE(midQ->resp_buf)); |
@@ -749,12 +745,11 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses, | |||
749 | *pbytes_returned = out_buf->smb_buf_length; | 745 | *pbytes_returned = out_buf->smb_buf_length; |
750 | 746 | ||
751 | /* BB special case reconnect tid and uid here? */ | 747 | /* BB special case reconnect tid and uid here? */ |
752 | rc = map_smb_to_linux_error(out_buf); | 748 | rc = map_smb_to_linux_error(out_buf, 0 /* no log */ ); |
753 | 749 | ||
754 | /* convert ByteCount if necessary */ | 750 | /* convert ByteCount if necessary */ |
755 | if (receive_len >= | 751 | if (receive_len >= sizeof(struct smb_hdr) - 4 |
756 | sizeof (struct smb_hdr) - | 752 | /* do not count RFC1001 header */ + |
757 | 4 /* do not count RFC1001 header */ + | ||
758 | (2 * out_buf->WordCount) + 2 /* bcc */ ) | 753 | (2 * out_buf->WordCount) + 2 /* bcc */ ) |
759 | BCC(out_buf) = le16_to_cpu(BCC_LE(out_buf)); | 754 | BCC(out_buf) = le16_to_cpu(BCC_LE(out_buf)); |
760 | } else { | 755 | } else { |
@@ -993,12 +988,11 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon, | |||
993 | *pbytes_returned = out_buf->smb_buf_length; | 988 | *pbytes_returned = out_buf->smb_buf_length; |
994 | 989 | ||
995 | /* BB special case reconnect tid and uid here? */ | 990 | /* BB special case reconnect tid and uid here? */ |
996 | rc = map_smb_to_linux_error(out_buf); | 991 | rc = map_smb_to_linux_error(out_buf, 0 /* no log */ ); |
997 | 992 | ||
998 | /* convert ByteCount if necessary */ | 993 | /* convert ByteCount if necessary */ |
999 | if (receive_len >= | 994 | if (receive_len >= sizeof(struct smb_hdr) - 4 |
1000 | sizeof (struct smb_hdr) - | 995 | /* do not count RFC1001 header */ + |
1001 | 4 /* do not count RFC1001 header */ + | ||
1002 | (2 * out_buf->WordCount) + 2 /* bcc */ ) | 996 | (2 * out_buf->WordCount) + 2 /* bcc */ ) |
1003 | BCC(out_buf) = le16_to_cpu(BCC_LE(out_buf)); | 997 | BCC(out_buf) = le16_to_cpu(BCC_LE(out_buf)); |
1004 | } else { | 998 | } else { |