aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/transport.c
diff options
context:
space:
mode:
authorPavel Shilovsky <pshilovsky@samba.org>2012-09-18 19:20:30 -0400
committerSteve French <smfrench@gmail.com>2012-09-24 22:46:28 -0400
commit3c1bf7e48e9e463b65b1b90da4500a93dd2b27a7 (patch)
treec16caed7a01a5b1438b5acd8aa45929889da10ad /fs/cifs/transport.c
parent009d344398bb3e844b31eb9e6a7860748c6f6dd3 (diff)
CIFS: Enable signing in SMB2
Use hmac-sha256 and rather than hmac-md5 that is used for CIFS/SMB. Signature field in SMB2 header is 16 bytes instead of 8 bytes. Automatically enable signing by client when requested by the server when signing ability is available to the client. Signed-off-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com> Signed-off-by: Sachin Prabhu <sprabhu@redhat.com> Signed-off-by: Pavel Shilovsky <piastryyy@gmail.com> Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs/transport.c')
-rw-r--r--fs/cifs/transport.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index d9b639b95fa8..c4d7825dfc0a 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -109,8 +109,8 @@ DeleteMidQEntry(struct mid_q_entry *midEntry)
109 mempool_free(midEntry, cifs_mid_poolp); 109 mempool_free(midEntry, cifs_mid_poolp);
110} 110}
111 111
112static void 112void
113delete_mid(struct mid_q_entry *mid) 113cifs_delete_mid(struct mid_q_entry *mid)
114{ 114{
115 spin_lock(&GlobalMid_Lock); 115 spin_lock(&GlobalMid_Lock);
116 list_del(&mid->qhead); 116 list_del(&mid->qhead);
@@ -419,7 +419,7 @@ cifs_call_async(struct TCP_Server_Info *server, struct kvec *iov,
419 if (rc == 0) 419 if (rc == 0)
420 return 0; 420 return 0;
421 421
422 delete_mid(mid); 422 cifs_delete_mid(mid);
423 add_credits(server, 1, optype); 423 add_credits(server, 1, optype);
424 wake_up(&server->request_q); 424 wake_up(&server->request_q);
425 return rc; 425 return rc;
@@ -532,7 +532,7 @@ cifs_setup_request(struct cifs_ses *ses, struct kvec *iov,
532 return rc; 532 return rc;
533 rc = cifs_sign_smbv(iov, nvec, ses->server, &mid->sequence_number); 533 rc = cifs_sign_smbv(iov, nvec, ses->server, &mid->sequence_number);
534 if (rc) 534 if (rc)
535 delete_mid(mid); 535 cifs_delete_mid(mid);
536 *ret_mid = mid; 536 *ret_mid = mid;
537 return rc; 537 return rc;
538} 538}
@@ -652,11 +652,11 @@ SendReceive2(const unsigned int xid, struct cifs_ses *ses,
652 rc = ses->server->ops->check_receive(midQ, ses->server, 652 rc = ses->server->ops->check_receive(midQ, ses->server,
653 flags & CIFS_LOG_ERROR); 653 flags & CIFS_LOG_ERROR);
654 654
655 /* mark it so buf will not be freed by delete_mid */ 655 /* mark it so buf will not be freed by cifs_delete_mid */
656 if ((flags & CIFS_NO_RESP) == 0) 656 if ((flags & CIFS_NO_RESP) == 0)
657 midQ->resp_buf = NULL; 657 midQ->resp_buf = NULL;
658out: 658out:
659 delete_mid(midQ); 659 cifs_delete_mid(midQ);
660 add_credits(ses->server, credits, optype); 660 add_credits(ses->server, credits, optype);
661 661
662 return rc; 662 return rc;
@@ -762,7 +762,7 @@ SendReceive(const unsigned int xid, struct cifs_ses *ses,
762 memcpy(out_buf, midQ->resp_buf, *pbytes_returned + 4); 762 memcpy(out_buf, midQ->resp_buf, *pbytes_returned + 4);
763 rc = cifs_check_receive(midQ, ses->server, 0); 763 rc = cifs_check_receive(midQ, ses->server, 0);
764out: 764out:
765 delete_mid(midQ); 765 cifs_delete_mid(midQ);
766 add_credits(ses->server, 1, 0); 766 add_credits(ses->server, 1, 0);
767 767
768 return rc; 768 return rc;
@@ -846,7 +846,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon,
846 846
847 rc = cifs_sign_smb(in_buf, ses->server, &midQ->sequence_number); 847 rc = cifs_sign_smb(in_buf, ses->server, &midQ->sequence_number);
848 if (rc) { 848 if (rc) {
849 delete_mid(midQ); 849 cifs_delete_mid(midQ);
850 mutex_unlock(&ses->server->srv_mutex); 850 mutex_unlock(&ses->server->srv_mutex);
851 return rc; 851 return rc;
852 } 852 }
@@ -859,7 +859,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon,
859 mutex_unlock(&ses->server->srv_mutex); 859 mutex_unlock(&ses->server->srv_mutex);
860 860
861 if (rc < 0) { 861 if (rc < 0) {
862 delete_mid(midQ); 862 cifs_delete_mid(midQ);
863 return rc; 863 return rc;
864 } 864 }
865 865
@@ -880,7 +880,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon,
880 blocking lock to return. */ 880 blocking lock to return. */
881 rc = send_cancel(ses->server, in_buf, midQ); 881 rc = send_cancel(ses->server, in_buf, midQ);
882 if (rc) { 882 if (rc) {
883 delete_mid(midQ); 883 cifs_delete_mid(midQ);
884 return rc; 884 return rc;
885 } 885 }
886 } else { 886 } else {
@@ -892,7 +892,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon,
892 /* If we get -ENOLCK back the lock may have 892 /* If we get -ENOLCK back the lock may have
893 already been removed. Don't exit in this case. */ 893 already been removed. Don't exit in this case. */
894 if (rc && rc != -ENOLCK) { 894 if (rc && rc != -ENOLCK) {
895 delete_mid(midQ); 895 cifs_delete_mid(midQ);
896 return rc; 896 return rc;
897 } 897 }
898 } 898 }
@@ -929,7 +929,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon,
929 memcpy(out_buf, midQ->resp_buf, *pbytes_returned + 4); 929 memcpy(out_buf, midQ->resp_buf, *pbytes_returned + 4);
930 rc = cifs_check_receive(midQ, ses->server, 0); 930 rc = cifs_check_receive(midQ, ses->server, 0);
931out: 931out:
932 delete_mid(midQ); 932 cifs_delete_mid(midQ);
933 if (rstart && rc == -EACCES) 933 if (rstart && rc == -EACCES)
934 return -ERESTARTSYS; 934 return -ERESTARTSYS;
935 return rc; 935 return rc;