]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
cifs: store the real expected sequence number in the mid
authorJeff Layton <jlayton@redhat.com>
Wed, 3 Apr 2013 15:55:03 +0000 (11:55 -0400)
committerSteve French <smfrench@gmail.com>
Sun, 5 May 2013 03:18:01 +0000 (22:18 -0500)
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>
fs/cifs/cifsencrypt.c
fs/cifs/cifssmb.c
fs/cifs/transport.c

index 2cbbec6ce9cbca293d61a8691ce33e16019ce1bf..71436d1fca13bede14a8a25ac6a9ae126e80dede 100644 (file)
@@ -135,8 +135,8 @@ int cifs_sign_rqst(struct smb_rqst *rqst, struct TCP_Server_Info *server,
                                cpu_to_le32(server->sequence_number);
        cifs_pdu->Signature.Sequence.Reserved = 0;
 
-       *pexpected_response_sequence_number = server->sequence_number++;
-       server->sequence_number++;
+       *pexpected_response_sequence_number = ++server->sequence_number;
+       ++server->sequence_number;
 
        rc = cifs_calc_signature(rqst, server, smb_signature);
        if (rc)
index 728b3176984a069b878625a9a314621ec0410ce2..a58dc77cc4430d57d8c8226c3120f3a12519fb00 100644 (file)
@@ -1545,7 +1545,7 @@ cifs_readv_callback(struct mid_q_entry *mid)
                        int rc = 0;
 
                        rc = cifs_verify_signature(&rqst, server,
-                                                 mid->sequence_number + 1);
+                                                 mid->sequence_number);
                        if (rc)
                                cifs_dbg(VFS, "SMB signature verification returned error = %d\n",
                                         rc);
index 293d2c83dfbeab99b9e23787df0b0978ce29617b..bfbf4700d160f8a4d54f7cc0446a35c4de8c747d 100644 (file)
@@ -622,7 +622,7 @@ cifs_check_receive(struct mid_q_entry *mid, struct TCP_Server_Info *server,
                iov.iov_len = len;
                /* FIXME: add code to kill session */
                rc = cifs_verify_signature(&rqst, server,
-                                          mid->sequence_number + 1);
+                                          mid->sequence_number);
                if (rc)
                        cifs_dbg(VFS, "SMB signature verification returned error = %d\n",
                                 rc);