diff options
author | Jeff Layton <jlayton@redhat.com> | 2013-04-03 11:55:03 -0400 |
---|---|---|
committer | Steve French <smfrench@gmail.com> | 2013-05-04 23:18:01 -0400 |
commit | 0124cc45113f93b52c76589dc596a026917859bb (patch) | |
tree | 543f7b35f2392e3fe24e96c940c840ef6c454304 | |
parent | ad313cb86dfba27f8f2306da304974ef17c91c56 (diff) |
cifs: store the real expected sequence number in the mid
Currently, the signing routines take a pointer to a place to store the
expected sequence number for the mid response. It then stores a value
that's one below what that sequence number should be, and then adds one
to it when verifying the signature on the response.
Increment the sequence number before storing the value in the mid, and
eliminate the "+1" when checking the signature.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Signed-off-by: Steve French <smfrench@gmail.com>
-rw-r--r-- | fs/cifs/cifsencrypt.c | 4 | ||||
-rw-r--r-- | fs/cifs/cifssmb.c | 2 | ||||
-rw-r--r-- | fs/cifs/transport.c | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c index 2cbbec6ce9cb..71436d1fca13 100644 --- a/fs/cifs/cifsencrypt.c +++ b/fs/cifs/cifsencrypt.c | |||
@@ -135,8 +135,8 @@ int cifs_sign_rqst(struct smb_rqst *rqst, struct TCP_Server_Info *server, | |||
135 | cpu_to_le32(server->sequence_number); | 135 | cpu_to_le32(server->sequence_number); |
136 | cifs_pdu->Signature.Sequence.Reserved = 0; | 136 | cifs_pdu->Signature.Sequence.Reserved = 0; |
137 | 137 | ||
138 | *pexpected_response_sequence_number = server->sequence_number++; | 138 | *pexpected_response_sequence_number = ++server->sequence_number; |
139 | server->sequence_number++; | 139 | ++server->sequence_number; |
140 | 140 | ||
141 | rc = cifs_calc_signature(rqst, server, smb_signature); | 141 | rc = cifs_calc_signature(rqst, server, smb_signature); |
142 | if (rc) | 142 | if (rc) |
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 728b3176984a..a58dc77cc443 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -1545,7 +1545,7 @@ cifs_readv_callback(struct mid_q_entry *mid) | |||
1545 | int rc = 0; | 1545 | int rc = 0; |
1546 | 1546 | ||
1547 | rc = cifs_verify_signature(&rqst, server, | 1547 | rc = cifs_verify_signature(&rqst, server, |
1548 | mid->sequence_number + 1); | 1548 | mid->sequence_number); |
1549 | if (rc) | 1549 | if (rc) |
1550 | cifs_dbg(VFS, "SMB signature verification returned error = %d\n", | 1550 | cifs_dbg(VFS, "SMB signature verification returned error = %d\n", |
1551 | rc); | 1551 | rc); |
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c index 293d2c83dfbe..bfbf4700d160 100644 --- a/fs/cifs/transport.c +++ b/fs/cifs/transport.c | |||
@@ -622,7 +622,7 @@ cifs_check_receive(struct mid_q_entry *mid, struct TCP_Server_Info *server, | |||
622 | iov.iov_len = len; | 622 | iov.iov_len = len; |
623 | /* FIXME: add code to kill session */ | 623 | /* FIXME: add code to kill session */ |
624 | rc = cifs_verify_signature(&rqst, server, | 624 | rc = cifs_verify_signature(&rqst, server, |
625 | mid->sequence_number + 1); | 625 | mid->sequence_number); |
626 | if (rc) | 626 | if (rc) |
627 | cifs_dbg(VFS, "SMB signature verification returned error = %d\n", | 627 | cifs_dbg(VFS, "SMB signature verification returned error = %d\n", |
628 | rc); | 628 | rc); |