summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorNamjae Jeon <linkinjeon@kernel.org>2026-07-02 19:37:53 +0900
committerSteve French <stfrench@microsoft.com>2026-07-06 07:55:41 -0500
commit9e8ad620ddfde5a5f4ef58372e3805e9388cb0f4 (patch)
tree54e367ac4f59c50d8dcbe3d3fcf7004b738d2e0f /fs
parent216c5aba4ebde1a6e85d7831c0cf39a9a2ad7a38 (diff)
downloadlinux-next-9e8ad620ddfde5a5f4ef58372e3805e9388cb0f4.tar.gz
linux-next-9e8ad620ddfde5a5f4ef58372e3805e9388cb0f4.zip
ksmbd: mark invalid session responses as signed
When a signed request uses a session that is not registered on the connection, ksmbd returns STATUS_USER_SESSION_DELETED before reaching the normal response signing path. The response therefore lacks SMB2_FLAGS_SIGNED. Clients that require signing check this flag before handling STATUS_USER_SESSION_DELETED and replace the server status with STATUS_ACCESS_DENIED when it is absent. The protocol permits this error response to skip signature verification because the connection has no matching session key. Preserve SMB2_FLAGS_SIGNED on the early error response when the request was signed. This lets the client propagate STATUS_USER_SESSION_DELETED. It fixes smb2.session.bind2. Signed-off-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/smb/server/server.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/smb/server/server.c b/fs/smb/server/server.c
index 36a5ea4828ad..bc861ca4f0cc 100644
--- a/fs/smb/server/server.c
+++ b/fs/smb/server/server.c
@@ -199,6 +199,12 @@ static void __handle_ksmbd_work(struct ksmbd_work *work,
else
conn->ops->set_rsp_status(work,
STATUS_USER_SESSION_DELETED);
+ if (conn->ops->is_sign_req(work, conn->ops->get_cmd_val(work))) {
+ struct smb2_hdr *rsp_hdr;
+
+ rsp_hdr = ksmbd_resp_buf_curr(work);
+ rsp_hdr->Flags |= SMB2_FLAGS_SIGNED;
+ }
goto send;
} else if (rc > 0) {
rc = conn->ops->get_ksmbd_tcon(work);