All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] cifs: New optype for session operations.
@ 2021-02-04  8:05 Shyam Prasad N
  2021-02-04 10:04 ` Aurélien Aptel
  0 siblings, 1 reply; 9+ messages in thread
From: Shyam Prasad N @ 2021-02-04  8:05 UTC (permalink / raw)
  To: Steve French, Pavel Shilovsky, Aurélien Aptel, CIFS

[-- Attachment #1: Type: text/plain, Size: 131 bytes --]

Tested with SMB 3.1.1 and 3.0 with and without multichannel.
Also included some review comments from Aurelien.

-- 
Regards,
Shyam

[-- Attachment #2: 0001-cifs-New-optype-for-session-operations.patch --]
[-- Type: application/octet-stream, Size: 2831 bytes --]

From 74418a48af50940cad30fcb8d7a6d90efeea92ea Mon Sep 17 00:00:00 2001
From: Shyam Prasad N <sprasad@microsoft.com>
Date: Wed, 3 Feb 2021 22:49:52 -0800
Subject: [PATCH 1/4] cifs: New optype for session operations.

We used to share the CIFS_NEG_OP flag between negotiate and
session authentication. There was an assumption in the code that
CIFS_NEG_OP is used by negotiate only. So introcuded CIFS_SESS_OP
and used it for session setup optypes.

Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
---
 fs/cifs/cifsglob.h  | 3 ++-
 fs/cifs/smb2pdu.c   | 2 +-
 fs/cifs/transport.c | 4 ++--
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 50fcb65920e8..1a1f9f4ae80a 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -1704,7 +1704,8 @@ static inline bool is_retryable_error(int error)
 #define   CIFS_ECHO_OP      0x080    /* echo request */
 #define   CIFS_OBREAK_OP   0x0100    /* oplock break request */
 #define   CIFS_NEG_OP      0x0200    /* negotiate request */
-#define   CIFS_OP_MASK     0x0380    /* mask request type */
+#define   CIFS_SESS_OP     0x2000    /* session setup request */
+#define   CIFS_OP_MASK     0x2380    /* mask request type */
 
 #define   CIFS_HAS_CREDITS 0x0400    /* already has credits */
 #define   CIFS_TRANSFORM_REQ 0x0800    /* transform request before sending */
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index e1391bd92768..4bbb6126b14d 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -1261,7 +1261,7 @@ SMB2_sess_sendreceive(struct SMB2_sess_data *sess_data)
 			    cifs_ses_server(sess_data->ses),
 			    &rqst,
 			    &sess_data->buf0_type,
-			    CIFS_LOG_ERROR | CIFS_NEG_OP, &rsp_iov);
+			    CIFS_LOG_ERROR | CIFS_SESS_OP, &rsp_iov);
 	cifs_small_buf_release(sess_data->iov[0].iov_base);
 	memcpy(&sess_data->iov[0], &rsp_iov, sizeof(struct kvec));
 
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index 4a2b836eb017..41223a9ee086 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -1171,7 +1171,7 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses,
 	/*
 	 * Compounding is never used during session establish.
 	 */
-	if ((ses->status == CifsNew) || (optype & CIFS_NEG_OP))
+	if ((ses->status == CifsNew) || (optype & CIFS_NEG_OP) || (optype & CIFS_SESS_OP))
 		smb311_update_preauth_hash(ses, rqst[0].rq_iov,
 					   rqst[0].rq_nvec);
 
@@ -1236,7 +1236,7 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses,
 	/*
 	 * Compounding is never used during session establish.
 	 */
-	if ((ses->status == CifsNew) || (optype & CIFS_NEG_OP)) {
+	if ((ses->status == CifsNew) || (optype & CIFS_NEG_OP) || (optype & CIFS_SESS_OP)) {
 		struct kvec iov = {
 			.iov_base = resp_iov[0].iov_base,
 			.iov_len = resp_iov[0].iov_len
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-02-10  6:17 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-04  8:05 [PATCH 1/4] cifs: New optype for session operations Shyam Prasad N
2021-02-04 10:04 ` Aurélien Aptel
2021-02-09  1:59   ` Shyam Prasad N
2021-02-09 11:22     ` Aurélien Aptel
2021-02-09 19:58       ` Pavel Shilovsky
2021-02-09 20:05         ` Steve French
2021-02-09 20:07           ` Pavel Shilovsky
2021-02-10  5:47             ` Shyam Prasad N
2021-02-10  6:09               ` Shyam Prasad N

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.