aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-12-06 10:38:19 -0500
committerSteve French <sfrench@us.ibm.com>2008-12-25 21:29:12 -0500
commit17c8bfed8abbbed82937a751abfc40d2866e3196 (patch)
tree88f8924eedbd98d5c1ec116fa8862a899ed1b658 /fs
parent2b2bdfba7a3679f67b7c3aca4a4b08b24bb675a8 (diff)
Streamline SendReceiveBlockingLock: Use "goto out:" in an error condition
Streamline SendReceiveBlockingLock: Use "goto out:" in an error condition Signed-off-by: Volker Lendecke <vl@samba.org> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/cifs/transport.c70
1 files changed, 37 insertions, 33 deletions
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index ca015e60002a..0fe2527ce459 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -1062,44 +1062,48 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
1062 cERROR(1, ("Frame too large received. Length: %d Xid: %d", 1062 cERROR(1, ("Frame too large received. Length: %d Xid: %d",
1063 receive_len, xid)); 1063 receive_len, xid));
1064 rc = -EIO; 1064 rc = -EIO;
1065 } else { /* rcvd frame is ok */ 1065 goto out;
1066 1066 }
1067 if (midQ->resp_buf && out_buf
1068 && (midQ->midState == MID_RESPONSE_RECEIVED)) {
1069 out_buf->smb_buf_length = receive_len;
1070 memcpy((char *)out_buf + 4,
1071 (char *)midQ->resp_buf + 4,
1072 receive_len);
1073
1074 dump_smb(out_buf, 92);
1075 /* convert the length into a more usable form */
1076 if ((receive_len > 24) &&
1077 (ses->server->secMode & (SECMODE_SIGN_REQUIRED |
1078 SECMODE_SIGN_ENABLED))) {
1079 rc = cifs_verify_signature(out_buf,
1080 &ses->server->mac_signing_key,
1081 midQ->sequence_number+1);
1082 if (rc) {
1083 cERROR(1, ("Unexpected SMB signature"));
1084 /* BB FIXME add code to kill session */
1085 }
1086 }
1087 1067
1088 *pbytes_returned = out_buf->smb_buf_length; 1068 /* rcvd frame is ok */
1089 1069
1090 /* BB special case reconnect tid and uid here? */ 1070 if (midQ->resp_buf && out_buf
1091 rc = map_smb_to_linux_error(out_buf, 0 /* no log */ ); 1071 && (midQ->midState == MID_RESPONSE_RECEIVED)) {
1072 out_buf->smb_buf_length = receive_len;
1073 memcpy((char *)out_buf + 4,
1074 (char *)midQ->resp_buf + 4,
1075 receive_len);
1092 1076
1093 /* convert ByteCount if necessary */ 1077 dump_smb(out_buf, 92);
1094 if (receive_len >= sizeof(struct smb_hdr) - 4 1078 /* convert the length into a more usable form */
1095 /* do not count RFC1001 header */ + 1079 if ((receive_len > 24) &&
1096 (2 * out_buf->WordCount) + 2 /* bcc */ ) 1080 (ses->server->secMode & (SECMODE_SIGN_REQUIRED |
1097 BCC(out_buf) = le16_to_cpu(BCC_LE(out_buf)); 1081 SECMODE_SIGN_ENABLED))) {
1098 } else { 1082 rc = cifs_verify_signature(out_buf,
1099 rc = -EIO; 1083 &ses->server->mac_signing_key,
1100 cERROR(1, ("Bad MID state?")); 1084 midQ->sequence_number+1);
1085 if (rc) {
1086 cERROR(1, ("Unexpected SMB signature"));
1087 /* BB FIXME add code to kill session */
1088 }
1101 } 1089 }
1090
1091 *pbytes_returned = out_buf->smb_buf_length;
1092
1093 /* BB special case reconnect tid and uid here? */
1094 rc = map_smb_to_linux_error(out_buf, 0 /* no log */ );
1095
1096 /* convert ByteCount if necessary */
1097 if (receive_len >= sizeof(struct smb_hdr) - 4
1098 /* do not count RFC1001 header */ +
1099 (2 * out_buf->WordCount) + 2 /* bcc */ )
1100 BCC(out_buf) = le16_to_cpu(BCC_LE(out_buf));
1101 } else {
1102 rc = -EIO;
1103 cERROR(1, ("Bad MID state?"));
1102 } 1104 }
1105
1106out:
1103 DeleteMidQEntry(midQ); 1107 DeleteMidQEntry(midQ);
1104 if (rstart && rc == -EACCES) 1108 if (rstart && rc == -EACCES)
1105 return -ERESTARTSYS; 1109 return -ERESTARTSYS;