Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH 5.15.y 0/8] Additional ksmbd backport patches for linux-5.15.y
@ 2023-12-26 10:53 Namjae Jeon
  2023-12-26 10:53 ` [PATCH 5.15.y 1/8] ksmbd: add support for key exchange Namjae Jeon
                   ` (7 more replies)
  0 siblings, 8 replies; 13+ messages in thread
From: Namjae Jeon @ 2023-12-26 10:53 UTC (permalink / raw)
  To: gregkh, stable; +Cc: smfrench, Namjae Jeon

These patches are backport patches to support directory(v2) lease and
additional bug fixes for linux-5.15.y.

Namjae Jeon (8):
  ksmbd: add support for key exchange
  ksmbd: set epoch in create context v2 lease
  ksmbd: set v2 lease capability
  ksmbd: downgrade RWH lease caching state to RH for directory
  ksmbd: send v2 lease break notification for directory
  ksmbd: lazy v2 lease break on smb2_write()
  ksmbd: avoid duplicate opinfo_put() call on error of
    smb21_lease_break_ack()
  ksmbd: fix wrong allocation size update in smb2_open()

 fs/Kconfig           |   4 +-
 fs/ksmbd/oplock.c    | 115 ++++++++++++++++++++++++++++++++++++++-----
 fs/ksmbd/oplock.h    |   8 ++-
 fs/ksmbd/smb2ops.c   |   9 ++--
 fs/ksmbd/smb2pdu.c   |  61 +++++++++++++----------
 fs/ksmbd/smb2pdu.h   |   1 +
 fs/ksmbd/vfs.c       |   3 ++
 fs/ksmbd/vfs_cache.c |  13 ++++-
 fs/ksmbd/vfs_cache.h |   3 ++
 9 files changed, 171 insertions(+), 46 deletions(-)

-- 
2.25.1


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

* [PATCH 5.15.y 1/8] ksmbd: add support for key exchange
  2023-12-26 10:53 [PATCH 5.15.y 0/8] Additional ksmbd backport patches for linux-5.15.y Namjae Jeon
@ 2023-12-26 10:53 ` Namjae Jeon
  2023-12-26 14:59   ` Sasha Levin
  2023-12-26 10:53 ` [PATCH 5.15.y 2/8] ksmbd: set epoch in create context v2 lease Namjae Jeon
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 13+ messages in thread
From: Namjae Jeon @ 2023-12-26 10:53 UTC (permalink / raw)
  To: gregkh, stable; +Cc: smfrench, Namjae Jeon, Steve French

[ Upstream commit f9929ef6a2a55f03aac61248c6a3a987b8546f2a ]

When mounting cifs client, can see the following warning message.

CIFS: decode_ntlmssp_challenge: authentication has been weakened as server
does not support key exchange

To remove this warning message, Add support for key exchange feature to
ksmbd. This patch decrypts 16-byte ciphertext value sent by the client
using RC4 with session key. The decrypted value is the recovered secondary
key that will use instead of the session key for signing and sealing.

Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
---
 fs/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/Kconfig b/fs/Kconfig
index a6313a969bc5..971339ecc1a2 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -369,8 +369,8 @@ source "fs/ksmbd/Kconfig"
 
 config SMBFS_COMMON
 	tristate
-	default y if CIFS=y
-	default m if CIFS=m
+	default y if CIFS=y || SMB_SERVER=y
+	default m if CIFS=m || SMB_SERVER=m
 
 source "fs/coda/Kconfig"
 source "fs/afs/Kconfig"
-- 
2.25.1


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

* [PATCH 5.15.y 2/8] ksmbd: set epoch in create context v2 lease
  2023-12-26 10:53 [PATCH 5.15.y 0/8] Additional ksmbd backport patches for linux-5.15.y Namjae Jeon
  2023-12-26 10:53 ` [PATCH 5.15.y 1/8] ksmbd: add support for key exchange Namjae Jeon
@ 2023-12-26 10:53 ` Namjae Jeon
  2023-12-26 10:53 ` [PATCH 5.15.y 3/8] ksmbd: set v2 lease capability Namjae Jeon
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Namjae Jeon @ 2023-12-26 10:53 UTC (permalink / raw)
  To: gregkh, stable; +Cc: smfrench, Namjae Jeon, Steve French

[ Upstream commit d045850b628aaf931fc776c90feaf824dca5a1cf ]

To support v2 lease(directory lease), ksmbd set epoch in create context
v2 lease response.

Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
---
 fs/ksmbd/oplock.c | 5 ++++-
 fs/ksmbd/oplock.h | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/fs/ksmbd/oplock.c b/fs/ksmbd/oplock.c
index 1cf2d2a3746a..ed639b7b6509 100644
--- a/fs/ksmbd/oplock.c
+++ b/fs/ksmbd/oplock.c
@@ -104,7 +104,7 @@ static int alloc_lease(struct oplock_info *opinfo, struct lease_ctx_info *lctx)
 	lease->duration = lctx->duration;
 	memcpy(lease->parent_lease_key, lctx->parent_lease_key, SMB2_LEASE_KEY_SIZE);
 	lease->version = lctx->version;
-	lease->epoch = 0;
+	lease->epoch = le16_to_cpu(lctx->epoch);
 	INIT_LIST_HEAD(&opinfo->lease_entry);
 	opinfo->o_lease = lease;
 
@@ -1032,6 +1032,7 @@ static void copy_lease(struct oplock_info *op1, struct oplock_info *op2)
 	       SMB2_LEASE_KEY_SIZE);
 	lease2->duration = lease1->duration;
 	lease2->flags = lease1->flags;
+	lease2->epoch = lease1->epoch++;
 }
 
 static int add_lease_global_list(struct oplock_info *opinfo)
@@ -1364,6 +1365,7 @@ void create_lease_buf(u8 *rbuf, struct lease *lease)
 		memcpy(buf->lcontext.LeaseKey, lease->lease_key,
 		       SMB2_LEASE_KEY_SIZE);
 		buf->lcontext.LeaseFlags = lease->flags;
+		buf->lcontext.Epoch = cpu_to_le16(++lease->epoch);
 		buf->lcontext.LeaseState = lease->state;
 		memcpy(buf->lcontext.ParentLeaseKey, lease->parent_lease_key,
 		       SMB2_LEASE_KEY_SIZE);
@@ -1423,6 +1425,7 @@ struct lease_ctx_info *parse_lease_state(void *open_req)
 		memcpy(lreq->lease_key, lc->lcontext.LeaseKey, SMB2_LEASE_KEY_SIZE);
 		lreq->req_state = lc->lcontext.LeaseState;
 		lreq->flags = lc->lcontext.LeaseFlags;
+		lreq->epoch = lc->lcontext.Epoch;
 		lreq->duration = lc->lcontext.LeaseDuration;
 		memcpy(lreq->parent_lease_key, lc->lcontext.ParentLeaseKey,
 				SMB2_LEASE_KEY_SIZE);
diff --git a/fs/ksmbd/oplock.h b/fs/ksmbd/oplock.h
index 4b0fe6da7694..ad31439c61fe 100644
--- a/fs/ksmbd/oplock.h
+++ b/fs/ksmbd/oplock.h
@@ -34,6 +34,7 @@ struct lease_ctx_info {
 	__le32			flags;
 	__le64			duration;
 	__u8			parent_lease_key[SMB2_LEASE_KEY_SIZE];
+	__le16			epoch;
 	int			version;
 };
 
-- 
2.25.1


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

* [PATCH 5.15.y 3/8] ksmbd: set v2 lease capability
  2023-12-26 10:53 [PATCH 5.15.y 0/8] Additional ksmbd backport patches for linux-5.15.y Namjae Jeon
  2023-12-26 10:53 ` [PATCH 5.15.y 1/8] ksmbd: add support for key exchange Namjae Jeon
  2023-12-26 10:53 ` [PATCH 5.15.y 2/8] ksmbd: set epoch in create context v2 lease Namjae Jeon
@ 2023-12-26 10:53 ` Namjae Jeon
  2023-12-26 10:53 ` [PATCH 5.15.y 4/8] ksmbd: downgrade RWH lease caching state to RH for directory Namjae Jeon
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Namjae Jeon @ 2023-12-26 10:53 UTC (permalink / raw)
  To: gregkh, stable; +Cc: smfrench, Namjae Jeon, Steve French

[ Upstream commit 18dd1c367c31d0a060f737d48345747662369b64 ]

Set SMB2_GLOBAL_CAP_DIRECTORY_LEASING to ->capabilities to inform server
support directory lease to client.

Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
---
 fs/ksmbd/oplock.c  | 4 ----
 fs/ksmbd/smb2ops.c | 9 ++++++---
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/fs/ksmbd/oplock.c b/fs/ksmbd/oplock.c
index ed639b7b6509..24716dbe7108 100644
--- a/fs/ksmbd/oplock.c
+++ b/fs/ksmbd/oplock.c
@@ -1105,10 +1105,6 @@ int smb_grant_oplock(struct ksmbd_work *work, int req_op_level, u64 pid,
 	bool prev_op_has_lease;
 	__le32 prev_op_state = 0;
 
-	/* not support directory lease */
-	if (S_ISDIR(file_inode(fp->filp)->i_mode))
-		return 0;
-
 	opinfo = alloc_opinfo(work, pid, tid);
 	if (!opinfo)
 		return -ENOMEM;
diff --git a/fs/ksmbd/smb2ops.c b/fs/ksmbd/smb2ops.c
index 9138e1c29b22..c69943d96565 100644
--- a/fs/ksmbd/smb2ops.c
+++ b/fs/ksmbd/smb2ops.c
@@ -222,7 +222,8 @@ void init_smb3_0_server(struct ksmbd_conn *conn)
 	conn->signing_algorithm = SIGNING_ALG_AES_CMAC;
 
 	if (server_conf.flags & KSMBD_GLOBAL_FLAG_SMB2_LEASES)
-		conn->vals->capabilities |= SMB2_GLOBAL_CAP_LEASING;
+		conn->vals->capabilities |= SMB2_GLOBAL_CAP_LEASING |
+			SMB2_GLOBAL_CAP_DIRECTORY_LEASING;
 
 	if (server_conf.flags & KSMBD_GLOBAL_FLAG_SMB2_ENCRYPTION &&
 	    conn->cli_cap & SMB2_GLOBAL_CAP_ENCRYPTION)
@@ -246,7 +247,8 @@ void init_smb3_02_server(struct ksmbd_conn *conn)
 	conn->signing_algorithm = SIGNING_ALG_AES_CMAC;
 
 	if (server_conf.flags & KSMBD_GLOBAL_FLAG_SMB2_LEASES)
-		conn->vals->capabilities |= SMB2_GLOBAL_CAP_LEASING;
+		conn->vals->capabilities |= SMB2_GLOBAL_CAP_LEASING |
+			SMB2_GLOBAL_CAP_DIRECTORY_LEASING;
 
 	if (server_conf.flags & KSMBD_GLOBAL_FLAG_SMB2_ENCRYPTION ||
 	    (!(server_conf.flags & KSMBD_GLOBAL_FLAG_SMB2_ENCRYPTION_OFF) &&
@@ -271,7 +273,8 @@ int init_smb3_11_server(struct ksmbd_conn *conn)
 	conn->signing_algorithm = SIGNING_ALG_AES_CMAC;
 
 	if (server_conf.flags & KSMBD_GLOBAL_FLAG_SMB2_LEASES)
-		conn->vals->capabilities |= SMB2_GLOBAL_CAP_LEASING;
+		conn->vals->capabilities |= SMB2_GLOBAL_CAP_LEASING |
+			SMB2_GLOBAL_CAP_DIRECTORY_LEASING;
 
 	if (server_conf.flags & KSMBD_GLOBAL_FLAG_SMB2_ENCRYPTION ||
 	    (!(server_conf.flags & KSMBD_GLOBAL_FLAG_SMB2_ENCRYPTION_OFF) &&
-- 
2.25.1


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

* [PATCH 5.15.y 4/8] ksmbd: downgrade RWH lease caching state to RH for directory
  2023-12-26 10:53 [PATCH 5.15.y 0/8] Additional ksmbd backport patches for linux-5.15.y Namjae Jeon
                   ` (2 preceding siblings ...)
  2023-12-26 10:53 ` [PATCH 5.15.y 3/8] ksmbd: set v2 lease capability Namjae Jeon
@ 2023-12-26 10:53 ` Namjae Jeon
  2023-12-26 10:53 ` [PATCH 5.15.y 5/8] ksmbd: send v2 lease break notification " Namjae Jeon
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Namjae Jeon @ 2023-12-26 10:53 UTC (permalink / raw)
  To: gregkh, stable; +Cc: smfrench, Namjae Jeon, Steve French

[ Upstream commit eb547407f3572d2110cb1194ecd8865b3371a7a4 ]

RWH(Read + Write + Handle) caching state is not supported for directory.
ksmbd downgrade it to RH for directory if client send RWH caching lease
state.

Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
---
 fs/ksmbd/oplock.c  | 9 +++++++--
 fs/ksmbd/oplock.h  | 2 +-
 fs/ksmbd/smb2pdu.c | 8 ++++----
 3 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/fs/ksmbd/oplock.c b/fs/ksmbd/oplock.c
index 24716dbe7108..600312e2c6c2 100644
--- a/fs/ksmbd/oplock.c
+++ b/fs/ksmbd/oplock.c
@@ -1398,10 +1398,11 @@ void create_lease_buf(u8 *rbuf, struct lease *lease)
 /**
  * parse_lease_state() - parse lease context containted in file open request
  * @open_req:	buffer containing smb2 file open(create) request
+ * @is_dir:	whether leasing file is directory
  *
  * Return:  oplock state, -ENOENT if create lease context not found
  */
-struct lease_ctx_info *parse_lease_state(void *open_req)
+struct lease_ctx_info *parse_lease_state(void *open_req, bool is_dir)
 {
 	struct create_context *cc;
 	struct smb2_create_req *req = (struct smb2_create_req *)open_req;
@@ -1419,7 +1420,11 @@ struct lease_ctx_info *parse_lease_state(void *open_req)
 		struct create_lease_v2 *lc = (struct create_lease_v2 *)cc;
 
 		memcpy(lreq->lease_key, lc->lcontext.LeaseKey, SMB2_LEASE_KEY_SIZE);
-		lreq->req_state = lc->lcontext.LeaseState;
+		if (is_dir)
+			lreq->req_state = lc->lcontext.LeaseState &
+				~SMB2_LEASE_WRITE_CACHING_LE;
+		else
+			lreq->req_state = lc->lcontext.LeaseState;
 		lreq->flags = lc->lcontext.LeaseFlags;
 		lreq->epoch = lc->lcontext.Epoch;
 		lreq->duration = lc->lcontext.LeaseDuration;
diff --git a/fs/ksmbd/oplock.h b/fs/ksmbd/oplock.h
index ad31439c61fe..672127318c75 100644
--- a/fs/ksmbd/oplock.h
+++ b/fs/ksmbd/oplock.h
@@ -109,7 +109,7 @@ void opinfo_put(struct oplock_info *opinfo);
 
 /* Lease related functions */
 void create_lease_buf(u8 *rbuf, struct lease *lease);
-struct lease_ctx_info *parse_lease_state(void *open_req);
+struct lease_ctx_info *parse_lease_state(void *open_req, bool is_dir);
 __u8 smb2_map_lease_to_oplock(__le32 lease_state);
 int lease_read_to_write(struct oplock_info *opinfo);
 
diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c
index 7ce5746f9167..6a3cd6ea3af1 100644
--- a/fs/ksmbd/smb2pdu.c
+++ b/fs/ksmbd/smb2pdu.c
@@ -2729,10 +2729,6 @@ int smb2_open(struct ksmbd_work *work)
 		}
 	}
 
-	req_op_level = req->RequestedOplockLevel;
-	if (req_op_level == SMB2_OPLOCK_LEVEL_LEASE)
-		lc = parse_lease_state(req);
-
 	if (le32_to_cpu(req->ImpersonationLevel) > le32_to_cpu(IL_DELEGATE_LE)) {
 		pr_err("Invalid impersonationlevel : 0x%x\n",
 		       le32_to_cpu(req->ImpersonationLevel));
@@ -3212,6 +3208,10 @@ int smb2_open(struct ksmbd_work *work)
 		need_truncate = 1;
 	}
 
+	req_op_level = req->RequestedOplockLevel;
+	if (req_op_level == SMB2_OPLOCK_LEVEL_LEASE)
+		lc = parse_lease_state(req, S_ISDIR(file_inode(filp)->i_mode));
+
 	share_ret = ksmbd_smb_check_shared_mode(fp->filp, fp);
 	if (!test_share_config_flag(work->tcon->share_conf, KSMBD_SHARE_FLAG_OPLOCKS) ||
 	    (req_op_level == SMB2_OPLOCK_LEVEL_LEASE &&
-- 
2.25.1


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

* [PATCH 5.15.y 5/8] ksmbd: send v2 lease break notification for directory
  2023-12-26 10:53 [PATCH 5.15.y 0/8] Additional ksmbd backport patches for linux-5.15.y Namjae Jeon
                   ` (3 preceding siblings ...)
  2023-12-26 10:53 ` [PATCH 5.15.y 4/8] ksmbd: downgrade RWH lease caching state to RH for directory Namjae Jeon
@ 2023-12-26 10:53 ` Namjae Jeon
  2023-12-26 10:53 ` [PATCH 5.15.y 6/8] ksmbd: lazy v2 lease break on smb2_write() Namjae Jeon
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Namjae Jeon @ 2023-12-26 10:53 UTC (permalink / raw)
  To: gregkh, stable; +Cc: smfrench, Namjae Jeon, Steve French

[ Upstream commit d47d9886aeef79feba7adac701a510d65f3682b5 ]

If client send different parent key, different client guid, or there is
no parent lease key flags in create context v2 lease, ksmbd send lease
break to client.

Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
---
 fs/ksmbd/oplock.c    | 56 ++++++++++++++++++++++++++++++++++++++++----
 fs/ksmbd/oplock.h    |  4 ++++
 fs/ksmbd/smb2pdu.c   |  7 ++++++
 fs/ksmbd/smb2pdu.h   |  1 +
 fs/ksmbd/vfs_cache.c | 13 +++++++++-
 fs/ksmbd/vfs_cache.h |  2 ++
 6 files changed, 77 insertions(+), 6 deletions(-)

diff --git a/fs/ksmbd/oplock.c b/fs/ksmbd/oplock.c
index 600312e2c6c2..df6f00f58f19 100644
--- a/fs/ksmbd/oplock.c
+++ b/fs/ksmbd/oplock.c
@@ -102,6 +102,7 @@ static int alloc_lease(struct oplock_info *opinfo, struct lease_ctx_info *lctx)
 	lease->new_state = 0;
 	lease->flags = lctx->flags;
 	lease->duration = lctx->duration;
+	lease->is_dir = lctx->is_dir;
 	memcpy(lease->parent_lease_key, lctx->parent_lease_key, SMB2_LEASE_KEY_SIZE);
 	lease->version = lctx->version;
 	lease->epoch = le16_to_cpu(lctx->epoch);
@@ -543,12 +544,13 @@ static struct oplock_info *same_client_has_lease(struct ksmbd_inode *ci,
 			/* upgrading lease */
 			if ((atomic_read(&ci->op_count) +
 			     atomic_read(&ci->sop_count)) == 1) {
-				if (lease->state ==
-				    (lctx->req_state & lease->state)) {
+				if (lease->state != SMB2_LEASE_NONE_LE &&
+				    lease->state == (lctx->req_state & lease->state)) {
 					lease->state |= lctx->req_state;
 					if (lctx->req_state &
 						SMB2_LEASE_WRITE_CACHING_LE)
 						lease_read_to_write(opinfo);
+
 				}
 			} else if ((atomic_read(&ci->op_count) +
 				    atomic_read(&ci->sop_count)) > 1) {
@@ -900,7 +902,8 @@ static int oplock_break(struct oplock_info *brk_opinfo, int req_op_level)
 					lease->new_state =
 						SMB2_LEASE_READ_CACHING_LE;
 			} else {
-				if (lease->state & SMB2_LEASE_HANDLE_CACHING_LE)
+				if (lease->state & SMB2_LEASE_HANDLE_CACHING_LE &&
+						!lease->is_dir)
 					lease->new_state =
 						SMB2_LEASE_READ_CACHING_LE;
 				else
@@ -1082,6 +1085,48 @@ static void set_oplock_level(struct oplock_info *opinfo, int level,
 	}
 }
 
+void smb_send_parent_lease_break_noti(struct ksmbd_file *fp,
+				      struct lease_ctx_info *lctx)
+{
+	struct oplock_info *opinfo;
+	struct ksmbd_inode *p_ci = NULL;
+
+	if (lctx->version != 2)
+		return;
+
+	p_ci = ksmbd_inode_lookup_lock(fp->filp->f_path.dentry->d_parent);
+	if (!p_ci)
+		return;
+
+	read_lock(&p_ci->m_lock);
+	list_for_each_entry(opinfo, &p_ci->m_op_list, op_entry) {
+		if (!opinfo->is_lease)
+			continue;
+
+		if (opinfo->o_lease->state != SMB2_OPLOCK_LEVEL_NONE &&
+		    (!(lctx->flags & SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET_LE) ||
+		     !compare_guid_key(opinfo, fp->conn->ClientGUID,
+				      lctx->parent_lease_key))) {
+			if (!atomic_inc_not_zero(&opinfo->refcount))
+				continue;
+
+			atomic_inc(&opinfo->conn->r_count);
+			if (ksmbd_conn_releasing(opinfo->conn)) {
+				atomic_dec(&opinfo->conn->r_count);
+				continue;
+			}
+
+			read_unlock(&p_ci->m_lock);
+			oplock_break(opinfo, SMB2_OPLOCK_LEVEL_NONE);
+			opinfo_conn_put(opinfo);
+			read_lock(&p_ci->m_lock);
+		}
+	}
+	read_unlock(&p_ci->m_lock);
+
+	ksmbd_inode_put(p_ci);
+}
+
 /**
  * smb_grant_oplock() - handle oplock/lease request on file open
  * @work:		smb work
@@ -1420,10 +1465,11 @@ struct lease_ctx_info *parse_lease_state(void *open_req, bool is_dir)
 		struct create_lease_v2 *lc = (struct create_lease_v2 *)cc;
 
 		memcpy(lreq->lease_key, lc->lcontext.LeaseKey, SMB2_LEASE_KEY_SIZE);
-		if (is_dir)
+		if (is_dir) {
 			lreq->req_state = lc->lcontext.LeaseState &
 				~SMB2_LEASE_WRITE_CACHING_LE;
-		else
+			lreq->is_dir = true;
+		} else
 			lreq->req_state = lc->lcontext.LeaseState;
 		lreq->flags = lc->lcontext.LeaseFlags;
 		lreq->epoch = lc->lcontext.Epoch;
diff --git a/fs/ksmbd/oplock.h b/fs/ksmbd/oplock.h
index 672127318c75..b64d1536882a 100644
--- a/fs/ksmbd/oplock.h
+++ b/fs/ksmbd/oplock.h
@@ -36,6 +36,7 @@ struct lease_ctx_info {
 	__u8			parent_lease_key[SMB2_LEASE_KEY_SIZE];
 	__le16			epoch;
 	int			version;
+	bool			is_dir;
 };
 
 struct lease_table {
@@ -54,6 +55,7 @@ struct lease {
 	__u8			parent_lease_key[SMB2_LEASE_KEY_SIZE];
 	int			version;
 	unsigned short		epoch;
+	bool			is_dir;
 	struct lease_table	*l_lb;
 };
 
@@ -125,4 +127,6 @@ struct oplock_info *lookup_lease_in_table(struct ksmbd_conn *conn,
 int find_same_lease_key(struct ksmbd_session *sess, struct ksmbd_inode *ci,
 			struct lease_ctx_info *lctx);
 void destroy_lease_table(struct ksmbd_conn *conn);
+void smb_send_parent_lease_break_noti(struct ksmbd_file *fp,
+				      struct lease_ctx_info *lctx);
 #endif /* __KSMBD_OPLOCK_H */
diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c
index 6a3cd6ea3af1..c1dde4204366 100644
--- a/fs/ksmbd/smb2pdu.c
+++ b/fs/ksmbd/smb2pdu.c
@@ -3222,6 +3222,13 @@ int smb2_open(struct ksmbd_work *work)
 		}
 	} else {
 		if (req_op_level == SMB2_OPLOCK_LEVEL_LEASE) {
+			/*
+			 * Compare parent lease using parent key. If there is no
+			 * a lease that has same parent key, Send lease break
+			 * notification.
+			 */
+			smb_send_parent_lease_break_noti(fp, lc);
+
 			req_op_level = smb2_map_lease_to_oplock(lc->req_state);
 			ksmbd_debug(SMB,
 				    "lease req for(%s) req oplock state 0x%x, lease state 0x%x\n",
diff --git a/fs/ksmbd/smb2pdu.h b/fs/ksmbd/smb2pdu.h
index e1d0849ee68f..912bd94257ec 100644
--- a/fs/ksmbd/smb2pdu.h
+++ b/fs/ksmbd/smb2pdu.h
@@ -737,6 +737,7 @@ struct create_posix_rsp {
 #define SMB2_LEASE_WRITE_CACHING_LE		cpu_to_le32(0x04)
 
 #define SMB2_LEASE_FLAG_BREAK_IN_PROGRESS_LE	cpu_to_le32(0x02)
+#define SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET_LE	cpu_to_le32(0x04)
 
 #define SMB2_LEASE_KEY_SIZE			16
 
diff --git a/fs/ksmbd/vfs_cache.c b/fs/ksmbd/vfs_cache.c
index 774a387fccce..2528ce8aeebb 100644
--- a/fs/ksmbd/vfs_cache.c
+++ b/fs/ksmbd/vfs_cache.c
@@ -86,6 +86,17 @@ static struct ksmbd_inode *ksmbd_inode_lookup(struct ksmbd_file *fp)
 	return __ksmbd_inode_lookup(fp->filp->f_path.dentry);
 }
 
+struct ksmbd_inode *ksmbd_inode_lookup_lock(struct dentry *d)
+{
+	struct ksmbd_inode *ci;
+
+	read_lock(&inode_hash_lock);
+	ci = __ksmbd_inode_lookup(d);
+	read_unlock(&inode_hash_lock);
+
+	return ci;
+}
+
 int ksmbd_query_inode_status(struct dentry *dentry)
 {
 	struct ksmbd_inode *ci;
@@ -198,7 +209,7 @@ static void ksmbd_inode_free(struct ksmbd_inode *ci)
 	kfree(ci);
 }
 
-static void ksmbd_inode_put(struct ksmbd_inode *ci)
+void ksmbd_inode_put(struct ksmbd_inode *ci)
 {
 	if (atomic_dec_and_test(&ci->m_count))
 		ksmbd_inode_free(ci);
diff --git a/fs/ksmbd/vfs_cache.h b/fs/ksmbd/vfs_cache.h
index 8325cf4527c4..4d4938d6029b 100644
--- a/fs/ksmbd/vfs_cache.h
+++ b/fs/ksmbd/vfs_cache.h
@@ -138,6 +138,8 @@ struct ksmbd_file *ksmbd_lookup_foreign_fd(struct ksmbd_work *work, u64 id);
 struct ksmbd_file *ksmbd_lookup_fd_slow(struct ksmbd_work *work, u64 id,
 					u64 pid);
 void ksmbd_fd_put(struct ksmbd_work *work, struct ksmbd_file *fp);
+struct ksmbd_inode *ksmbd_inode_lookup_lock(struct dentry *d);
+void ksmbd_inode_put(struct ksmbd_inode *ci);
 struct ksmbd_file *ksmbd_lookup_durable_fd(unsigned long long id);
 struct ksmbd_file *ksmbd_lookup_fd_cguid(char *cguid);
 struct ksmbd_file *ksmbd_lookup_fd_inode(struct dentry *dentry);
-- 
2.25.1


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

* [PATCH 5.15.y 6/8] ksmbd: lazy v2 lease break on smb2_write()
  2023-12-26 10:53 [PATCH 5.15.y 0/8] Additional ksmbd backport patches for linux-5.15.y Namjae Jeon
                   ` (4 preceding siblings ...)
  2023-12-26 10:53 ` [PATCH 5.15.y 5/8] ksmbd: send v2 lease break notification " Namjae Jeon
@ 2023-12-26 10:53 ` Namjae Jeon
  2023-12-26 10:53 ` [PATCH 5.15.y 7/8] ksmbd: avoid duplicate opinfo_put() call on error of smb21_lease_break_ack() Namjae Jeon
  2023-12-26 10:53 ` [PATCH 5.15.y 8/8] ksmbd: fix wrong allocation size update in smb2_open() Namjae Jeon
  7 siblings, 0 replies; 13+ messages in thread
From: Namjae Jeon @ 2023-12-26 10:53 UTC (permalink / raw)
  To: gregkh, stable; +Cc: smfrench, Namjae Jeon, Steve French

[ Upstream commit c2a721eead71202a0d8ddd9b56ec8dce652c71d1 ]

Don't immediately send directory lease break notification on smb2_write().
Instead, It postpones it until smb2_close().

Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
---
 fs/ksmbd/oplock.c    | 45 ++++++++++++++++++++++++++++++++++++++++++--
 fs/ksmbd/oplock.h    |  1 +
 fs/ksmbd/vfs.c       |  3 +++
 fs/ksmbd/vfs_cache.h |  1 +
 4 files changed, 48 insertions(+), 2 deletions(-)

diff --git a/fs/ksmbd/oplock.c b/fs/ksmbd/oplock.c
index df6f00f58f19..2da256259722 100644
--- a/fs/ksmbd/oplock.c
+++ b/fs/ksmbd/oplock.c
@@ -396,8 +396,8 @@ void close_id_del_oplock(struct ksmbd_file *fp)
 {
 	struct oplock_info *opinfo;
 
-	if (S_ISDIR(file_inode(fp->filp)->i_mode))
-		return;
+	if (fp->reserve_lease_break)
+		smb_lazy_parent_lease_break_close(fp);
 
 	opinfo = opinfo_get(fp);
 	if (!opinfo)
@@ -1127,6 +1127,47 @@ void smb_send_parent_lease_break_noti(struct ksmbd_file *fp,
 	ksmbd_inode_put(p_ci);
 }
 
+void smb_lazy_parent_lease_break_close(struct ksmbd_file *fp)
+{
+	struct oplock_info *opinfo;
+	struct ksmbd_inode *p_ci = NULL;
+
+	rcu_read_lock();
+	opinfo = rcu_dereference(fp->f_opinfo);
+	rcu_read_unlock();
+
+	if (!opinfo->is_lease || opinfo->o_lease->version != 2)
+		return;
+
+	p_ci = ksmbd_inode_lookup_lock(fp->filp->f_path.dentry->d_parent);
+	if (!p_ci)
+		return;
+
+	read_lock(&p_ci->m_lock);
+	list_for_each_entry(opinfo, &p_ci->m_op_list, op_entry) {
+		if (!opinfo->is_lease)
+			continue;
+
+		if (opinfo->o_lease->state != SMB2_OPLOCK_LEVEL_NONE) {
+			if (!atomic_inc_not_zero(&opinfo->refcount))
+				continue;
+
+			atomic_inc(&opinfo->conn->r_count);
+			if (ksmbd_conn_releasing(opinfo->conn)) {
+				atomic_dec(&opinfo->conn->r_count);
+				continue;
+			}
+			read_unlock(&p_ci->m_lock);
+			oplock_break(opinfo, SMB2_OPLOCK_LEVEL_NONE);
+			opinfo_conn_put(opinfo);
+			read_lock(&p_ci->m_lock);
+		}
+	}
+	read_unlock(&p_ci->m_lock);
+
+	ksmbd_inode_put(p_ci);
+}
+
 /**
  * smb_grant_oplock() - handle oplock/lease request on file open
  * @work:		smb work
diff --git a/fs/ksmbd/oplock.h b/fs/ksmbd/oplock.h
index b64d1536882a..5b93ea9196c0 100644
--- a/fs/ksmbd/oplock.h
+++ b/fs/ksmbd/oplock.h
@@ -129,4 +129,5 @@ int find_same_lease_key(struct ksmbd_session *sess, struct ksmbd_inode *ci,
 void destroy_lease_table(struct ksmbd_conn *conn);
 void smb_send_parent_lease_break_noti(struct ksmbd_file *fp,
 				      struct lease_ctx_info *lctx);
+void smb_lazy_parent_lease_break_close(struct ksmbd_file *fp);
 #endif /* __KSMBD_OPLOCK_H */
diff --git a/fs/ksmbd/vfs.c b/fs/ksmbd/vfs.c
index a89529b21c86..173a488bfeee 100644
--- a/fs/ksmbd/vfs.c
+++ b/fs/ksmbd/vfs.c
@@ -517,6 +517,9 @@ int ksmbd_vfs_write(struct ksmbd_work *work, struct ksmbd_file *fp,
 		}
 	}
 
+	/* Reserve lease break for parent dir at closing time */
+	fp->reserve_lease_break = true;
+
 	/* Do we need to break any of a levelII oplock? */
 	smb_break_all_levII_oplock(work, fp, 1);
 
diff --git a/fs/ksmbd/vfs_cache.h b/fs/ksmbd/vfs_cache.h
index 4d4938d6029b..a528f0cc775a 100644
--- a/fs/ksmbd/vfs_cache.h
+++ b/fs/ksmbd/vfs_cache.h
@@ -105,6 +105,7 @@ struct ksmbd_file {
 	struct ksmbd_readdir_data	readdir_data;
 	int				dot_dotdot[2];
 	unsigned int			f_state;
+	bool				reserve_lease_break;
 };
 
 static inline void set_ctx_actor(struct dir_context *ctx,
-- 
2.25.1


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

* [PATCH 5.15.y 7/8] ksmbd: avoid duplicate opinfo_put() call on error of smb21_lease_break_ack()
  2023-12-26 10:53 [PATCH 5.15.y 0/8] Additional ksmbd backport patches for linux-5.15.y Namjae Jeon
                   ` (5 preceding siblings ...)
  2023-12-26 10:53 ` [PATCH 5.15.y 6/8] ksmbd: lazy v2 lease break on smb2_write() Namjae Jeon
@ 2023-12-26 10:53 ` Namjae Jeon
  2023-12-26 10:53 ` [PATCH 5.15.y 8/8] ksmbd: fix wrong allocation size update in smb2_open() Namjae Jeon
  7 siblings, 0 replies; 13+ messages in thread
From: Namjae Jeon @ 2023-12-26 10:53 UTC (permalink / raw)
  To: gregkh, stable; +Cc: smfrench, Namjae Jeon, Steve French

[ Upstream commit 658609d9a618d8881bf549b5893c0ba8fcff4526 ]

opinfo_put() could be called twice on error of smb21_lease_break_ack().
It will cause UAF issue if opinfo is referenced on other places.

Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
---
 fs/ksmbd/smb2pdu.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c
index c1dde4204366..e1c640ed7acc 100644
--- a/fs/ksmbd/smb2pdu.c
+++ b/fs/ksmbd/smb2pdu.c
@@ -8221,6 +8221,11 @@ static void smb21_lease_break_ack(struct ksmbd_work *work)
 			    le32_to_cpu(req->LeaseState));
 	}
 
+	if (ret < 0) {
+		rsp->hdr.Status = err;
+		goto err_out;
+	}
+
 	lease_state = lease->state;
 	opinfo->op_state = OPLOCK_STATE_NONE;
 	wake_up_interruptible_all(&opinfo->oplock_q);
@@ -8228,11 +8233,6 @@ static void smb21_lease_break_ack(struct ksmbd_work *work)
 	wake_up_interruptible_all(&opinfo->oplock_brk);
 	opinfo_put(opinfo);
 
-	if (ret < 0) {
-		rsp->hdr.Status = err;
-		goto err_out;
-	}
-
 	rsp->StructureSize = cpu_to_le16(36);
 	rsp->Reserved = 0;
 	rsp->Flags = 0;
-- 
2.25.1


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

* [PATCH 5.15.y 8/8] ksmbd: fix wrong allocation size update in smb2_open()
  2023-12-26 10:53 [PATCH 5.15.y 0/8] Additional ksmbd backport patches for linux-5.15.y Namjae Jeon
                   ` (6 preceding siblings ...)
  2023-12-26 10:53 ` [PATCH 5.15.y 7/8] ksmbd: avoid duplicate opinfo_put() call on error of smb21_lease_break_ack() Namjae Jeon
@ 2023-12-26 10:53 ` Namjae Jeon
  7 siblings, 0 replies; 13+ messages in thread
From: Namjae Jeon @ 2023-12-26 10:53 UTC (permalink / raw)
  To: gregkh, stable; +Cc: smfrench, Namjae Jeon, Steve French

[ Upstream commit a9f106c765c12d2f58aa33431bd8ce8e9d8a404a ]

When client send SMB2_CREATE_ALLOCATION_SIZE create context, ksmbd update
old size to ->AllocationSize in smb2 create response. ksmbd_vfs_getattr()
should be called after it to get updated stat result.

Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
---
 fs/ksmbd/smb2pdu.c | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c
index e1c640ed7acc..8875c04e8382 100644
--- a/fs/ksmbd/smb2pdu.c
+++ b/fs/ksmbd/smb2pdu.c
@@ -2516,7 +2516,7 @@ static void smb2_new_xattrs(struct ksmbd_tree_connect *tcon, const struct path *
 	da.flags = XATTR_DOSINFO_ATTRIB | XATTR_DOSINFO_CREATE_TIME |
 		XATTR_DOSINFO_ITIME;
 
-	rc = ksmbd_vfs_set_dos_attrib_xattr(mnt_user_ns(path->mnt), path, &da, false);
+	rc = ksmbd_vfs_set_dos_attrib_xattr(mnt_user_ns(path->mnt), path, &da, true);
 	if (rc)
 		ksmbd_debug(SMB, "failed to store file attribute into xattr\n");
 }
@@ -3182,23 +3182,6 @@ int smb2_open(struct ksmbd_work *work)
 		goto err_out;
 	}
 
-	rc = ksmbd_vfs_getattr(&path, &stat);
-	if (rc)
-		goto err_out;
-
-	if (stat.result_mask & STATX_BTIME)
-		fp->create_time = ksmbd_UnixTimeToNT(stat.btime);
-	else
-		fp->create_time = ksmbd_UnixTimeToNT(stat.ctime);
-	if (req->FileAttributes || fp->f_ci->m_fattr == 0)
-		fp->f_ci->m_fattr =
-			cpu_to_le32(smb2_get_dos_mode(&stat, le32_to_cpu(req->FileAttributes)));
-
-	if (!created)
-		smb2_update_xattrs(tcon, &path, fp);
-	else
-		smb2_new_xattrs(tcon, &path, fp);
-
 	if (file_present || created)
 		ksmbd_vfs_kern_path_unlock(&parent_path, &path);
 
@@ -3299,6 +3282,23 @@ int smb2_open(struct ksmbd_work *work)
 		}
 	}
 
+	rc = ksmbd_vfs_getattr(&path, &stat);
+	if (rc)
+		goto err_out1;
+
+	if (stat.result_mask & STATX_BTIME)
+		fp->create_time = ksmbd_UnixTimeToNT(stat.btime);
+	else
+		fp->create_time = ksmbd_UnixTimeToNT(stat.ctime);
+	if (req->FileAttributes || fp->f_ci->m_fattr == 0)
+		fp->f_ci->m_fattr =
+			cpu_to_le32(smb2_get_dos_mode(&stat, le32_to_cpu(req->FileAttributes)));
+
+	if (!created)
+		smb2_update_xattrs(tcon, &path, fp);
+	else
+		smb2_new_xattrs(tcon, &path, fp);
+
 	memcpy(fp->client_guid, conn->ClientGUID, SMB2_CLIENT_GUID_SIZE);
 
 	rsp->StructureSize = cpu_to_le16(89);
-- 
2.25.1


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

* Re: [PATCH 5.15.y 1/8] ksmbd: add support for key exchange
  2023-12-26 10:53 ` [PATCH 5.15.y 1/8] ksmbd: add support for key exchange Namjae Jeon
@ 2023-12-26 14:59   ` Sasha Levin
  2023-12-26 20:05     ` Namjae Jeon
  0 siblings, 1 reply; 13+ messages in thread
From: Sasha Levin @ 2023-12-26 14:59 UTC (permalink / raw)
  To: Namjae Jeon; +Cc: gregkh, stable, smfrench, Steve French

On Tue, Dec 26, 2023 at 07:53:26PM +0900, Namjae Jeon wrote:
>[ Upstream commit f9929ef6a2a55f03aac61248c6a3a987b8546f2a ]
>
>When mounting cifs client, can see the following warning message.
>
>CIFS: decode_ntlmssp_challenge: authentication has been weakened as server
>does not support key exchange
>
>To remove this warning message, Add support for key exchange feature to
>ksmbd. This patch decrypts 16-byte ciphertext value sent by the client
>using RC4 with session key. The decrypted value is the recovered secondary
>key that will use instead of the session key for signing and sealing.
>
>Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
>Signed-off-by: Steve French <stfrench@microsoft.com>
>---
> fs/Kconfig | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/fs/Kconfig b/fs/Kconfig
>index a6313a969bc5..971339ecc1a2 100644
>--- a/fs/Kconfig
>+++ b/fs/Kconfig
>@@ -369,8 +369,8 @@ source "fs/ksmbd/Kconfig"
>
> config SMBFS_COMMON
> 	tristate
>-	default y if CIFS=y
>-	default m if CIFS=m
>+	default y if CIFS=y || SMB_SERVER=y
>+	default m if CIFS=m || SMB_SERVER=m
>
> source "fs/coda/Kconfig"
> source "fs/afs/Kconfig"

This looks really weird: the hunk above is in the original upstream
patch, but what happened to the rest of the upstream code?

This change doesn't do what the message describing it says it does.

-- 
Thanks,
Sasha

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

* Re: [PATCH 5.15.y 1/8] ksmbd: add support for key exchange
  2023-12-26 14:59   ` Sasha Levin
@ 2023-12-26 20:05     ` Namjae Jeon
  2023-12-26 23:01       ` Sasha Levin
  0 siblings, 1 reply; 13+ messages in thread
From: Namjae Jeon @ 2023-12-26 20:05 UTC (permalink / raw)
  To: Sasha Levin; +Cc: gregkh, stable, smfrench, Steve French

2023-12-26 23:59 GMT+09:00, Sasha Levin <sashal@kernel.org>:
> On Tue, Dec 26, 2023 at 07:53:26PM +0900, Namjae Jeon wrote:
>>[ Upstream commit f9929ef6a2a55f03aac61248c6a3a987b8546f2a ]
>>
>>When mounting cifs client, can see the following warning message.
>>
>>CIFS: decode_ntlmssp_challenge: authentication has been weakened as server
>>does not support key exchange
>>
>>To remove this warning message, Add support for key exchange feature to
>>ksmbd. This patch decrypts 16-byte ciphertext value sent by the client
>>using RC4 with session key. The decrypted value is the recovered secondary
>>key that will use instead of the session key for signing and sealing.
>>
>>Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
>>Signed-off-by: Steve French <stfrench@microsoft.com>
>>---
>> fs/Kconfig | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>>diff --git a/fs/Kconfig b/fs/Kconfig
>>index a6313a969bc5..971339ecc1a2 100644
>>--- a/fs/Kconfig
>>+++ b/fs/Kconfig
>>@@ -369,8 +369,8 @@ source "fs/ksmbd/Kconfig"
>>
>> config SMBFS_COMMON
>> 	tristate
>>-	default y if CIFS=y
>>-	default m if CIFS=m
>>+	default y if CIFS=y || SMB_SERVER=y
>>+	default m if CIFS=m || SMB_SERVER=m
>>
>> source "fs/coda/Kconfig"
>> source "fs/afs/Kconfig"
>
> This looks really weird: the hunk above is in the original upstream
> patch, but what happened to the rest of the upstream code?
>
> This change doesn't do what the message describing it says it does.
There was a problem(omitted some changes) in the previous backport
patch, I didn't know what to do, so I just sent a patch like this.
Should I add it again after reverting the patch or just updating the
patch description?
>
> --
> Thanks,
> Sasha
>

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

* Re: [PATCH 5.15.y 1/8] ksmbd: add support for key exchange
  2023-12-26 20:05     ` Namjae Jeon
@ 2023-12-26 23:01       ` Sasha Levin
  2023-12-26 23:12         ` Namjae Jeon
  0 siblings, 1 reply; 13+ messages in thread
From: Sasha Levin @ 2023-12-26 23:01 UTC (permalink / raw)
  To: Namjae Jeon; +Cc: gregkh, stable, smfrench, Steve French

On Wed, Dec 27, 2023 at 05:05:10AM +0900, Namjae Jeon wrote:
>2023-12-26 23:59 GMT+09:00, Sasha Levin <sashal@kernel.org>:
>> On Tue, Dec 26, 2023 at 07:53:26PM +0900, Namjae Jeon wrote:
>>>[ Upstream commit f9929ef6a2a55f03aac61248c6a3a987b8546f2a ]
>>>
>>>When mounting cifs client, can see the following warning message.
>>>
>>>CIFS: decode_ntlmssp_challenge: authentication has been weakened as server
>>>does not support key exchange
>>>
>>>To remove this warning message, Add support for key exchange feature to
>>>ksmbd. This patch decrypts 16-byte ciphertext value sent by the client
>>>using RC4 with session key. The decrypted value is the recovered secondary
>>>key that will use instead of the session key for signing and sealing.
>>>
>>>Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
>>>Signed-off-by: Steve French <stfrench@microsoft.com>
>>>---
>>> fs/Kconfig | 4 ++--
>>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>>diff --git a/fs/Kconfig b/fs/Kconfig
>>>index a6313a969bc5..971339ecc1a2 100644
>>>--- a/fs/Kconfig
>>>+++ b/fs/Kconfig
>>>@@ -369,8 +369,8 @@ source "fs/ksmbd/Kconfig"
>>>
>>> config SMBFS_COMMON
>>> 	tristate
>>>-	default y if CIFS=y
>>>-	default m if CIFS=m
>>>+	default y if CIFS=y || SMB_SERVER=y
>>>+	default m if CIFS=m || SMB_SERVER=m
>>>
>>> source "fs/coda/Kconfig"
>>> source "fs/afs/Kconfig"
>>
>> This looks really weird: the hunk above is in the original upstream
>> patch, but what happened to the rest of the upstream code?
>>
>> This change doesn't do what the message describing it says it does.
>There was a problem(omitted some changes) in the previous backport
>patch, I didn't know what to do, so I just sent a patch like this.
>Should I add it again after reverting the patch or just updating the
>patch description?

Given that this was due to an issue with the backport, I'd say just
write a new commit message explaining what happened, and point the fixes
tag to c5049d2d73b2 ("ksmbd: add support for key exchange")

-- 
Thanks,
Sasha

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

* Re: [PATCH 5.15.y 1/8] ksmbd: add support for key exchange
  2023-12-26 23:01       ` Sasha Levin
@ 2023-12-26 23:12         ` Namjae Jeon
  0 siblings, 0 replies; 13+ messages in thread
From: Namjae Jeon @ 2023-12-26 23:12 UTC (permalink / raw)
  To: Sasha Levin; +Cc: gregkh, stable, smfrench, Steve French

2023-12-27 8:01 GMT+09:00, Sasha Levin <sashal@kernel.org>:
> On Wed, Dec 27, 2023 at 05:05:10AM +0900, Namjae Jeon wrote:
>>2023-12-26 23:59 GMT+09:00, Sasha Levin <sashal@kernel.org>:
>>> On Tue, Dec 26, 2023 at 07:53:26PM +0900, Namjae Jeon wrote:
>>>>[ Upstream commit f9929ef6a2a55f03aac61248c6a3a987b8546f2a ]
>>>>
>>>>When mounting cifs client, can see the following warning message.
>>>>
>>>>CIFS: decode_ntlmssp_challenge: authentication has been weakened as
>>>> server
>>>>does not support key exchange
>>>>
>>>>To remove this warning message, Add support for key exchange feature to
>>>>ksmbd. This patch decrypts 16-byte ciphertext value sent by the client
>>>>using RC4 with session key. The decrypted value is the recovered
>>>> secondary
>>>>key that will use instead of the session key for signing and sealing.
>>>>
>>>>Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
>>>>Signed-off-by: Steve French <stfrench@microsoft.com>
>>>>---
>>>> fs/Kconfig | 4 ++--
>>>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>>>
>>>>diff --git a/fs/Kconfig b/fs/Kconfig
>>>>index a6313a969bc5..971339ecc1a2 100644
>>>>--- a/fs/Kconfig
>>>>+++ b/fs/Kconfig
>>>>@@ -369,8 +369,8 @@ source "fs/ksmbd/Kconfig"
>>>>
>>>> config SMBFS_COMMON
>>>> 	tristate
>>>>-	default y if CIFS=y
>>>>-	default m if CIFS=m
>>>>+	default y if CIFS=y || SMB_SERVER=y
>>>>+	default m if CIFS=m || SMB_SERVER=m
>>>>
>>>> source "fs/coda/Kconfig"
>>>> source "fs/afs/Kconfig"
>>>
>>> This looks really weird: the hunk above is in the original upstream
>>> patch, but what happened to the rest of the upstream code?
>>>
>>> This change doesn't do what the message describing it says it does.
>>There was a problem(omitted some changes) in the previous backport
>>patch, I didn't know what to do, so I just sent a patch like this.
>>Should I add it again after reverting the patch or just updating the
>>patch description?
>
> Given that this was due to an issue with the backport, I'd say just
> write a new commit message explaining what happened, and point the fixes
> tag to c5049d2d73b2 ("ksmbd: add support for key exchange")
Okay, I will do that, Thanks for your answer!
>
> --
> Thanks,
> Sasha
>

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

end of thread, other threads:[~2023-12-26 23:12 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-26 10:53 [PATCH 5.15.y 0/8] Additional ksmbd backport patches for linux-5.15.y Namjae Jeon
2023-12-26 10:53 ` [PATCH 5.15.y 1/8] ksmbd: add support for key exchange Namjae Jeon
2023-12-26 14:59   ` Sasha Levin
2023-12-26 20:05     ` Namjae Jeon
2023-12-26 23:01       ` Sasha Levin
2023-12-26 23:12         ` Namjae Jeon
2023-12-26 10:53 ` [PATCH 5.15.y 2/8] ksmbd: set epoch in create context v2 lease Namjae Jeon
2023-12-26 10:53 ` [PATCH 5.15.y 3/8] ksmbd: set v2 lease capability Namjae Jeon
2023-12-26 10:53 ` [PATCH 5.15.y 4/8] ksmbd: downgrade RWH lease caching state to RH for directory Namjae Jeon
2023-12-26 10:53 ` [PATCH 5.15.y 5/8] ksmbd: send v2 lease break notification " Namjae Jeon
2023-12-26 10:53 ` [PATCH 5.15.y 6/8] ksmbd: lazy v2 lease break on smb2_write() Namjae Jeon
2023-12-26 10:53 ` [PATCH 5.15.y 7/8] ksmbd: avoid duplicate opinfo_put() call on error of smb21_lease_break_ack() Namjae Jeon
2023-12-26 10:53 ` [PATCH 5.15.y 8/8] ksmbd: fix wrong allocation size update in smb2_open() Namjae Jeon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox