Skip to contentSkip to conversation

ksmbd: don't grant a persistent handle if the share is not continuous availability

PATCH New Namjae Jeon 1 participant 1 message Apr 12, 2024

Subsystems (2)
lore
Share & tools
lore

Namjae Jeon

author maintainer
#0 lore raw

PATCH 1/1 ksmbd: don't grant a persistent handle if the share is not continuous availability

If capabilities of the share is not SMB2_SHARE_CAP_CONTINUOUS_AVAILABILITY, ksmbd should not grant a persistent handle to the client.

---
 fs/smb/server/mgmt/tree_connect.h | 1 +
 fs/smb/server/smb2pdu.c           | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)
fs/smb/server/mgmt/tree_connect.h +1 -0
index 6377a70b811c..27de34200c83 100644
@@ -34,6 +34,7 @@ struct ksmbd_tree_connect {
 	atomic_t			refcount;
 	wait_queue_head_t		refcount_q;
 	unsigned int			t_state;
+	unsigned int			t_cap;
 };
 
 struct ksmbd_tree_conn_status {
fs/smb/server/smb2pdu.c +2 -1
index 5723bbf372d7..1f1f06c5174e 100644
@@ -3498,7 +3498,8 @@ int smb2_open(struct ksmbd_work *work)
 	memcpy(fp->client_guid, conn->ClientGUID, SMB2_CLIENT_GUID_SIZE);
 
 	if (dh_info.type == DURABLE_REQ_V2 || dh_info.type == DURABLE_REQ) {
-		if (dh_info.type == DURABLE_REQ_V2 && dh_info.persistent)
+		if (dh_info.type == DURABLE_REQ_V2 && dh_info.persistent &&
+		    tcon->t_cap & SMB2_SHARE_CAP_CONTINUOUS_AVAILABILITY)
 			fp->is_persistent = true;
 		else
 			fp->is_durable = true;
Signature · 1 line
2.25.1