summaryrefslogtreecommitdiff
path: root/fs/ksmbd/server.c
diff options
context:
space:
mode:
authorNamjae Jeon <linkinjeon@kernel.org>2023-05-03 10:45:00 +0300
committerSteve French <stfrench@microsoft.com>2023-05-04 07:03:01 +0300
commitf5c779b7ddbda30866cf2a27c63e34158f858c73 (patch)
treed306574cebf6e016eb339ec2bf44515f7eaac7cb /fs/ksmbd/server.c
parent3ac00a2ab69b34189942afa9e862d5170cdcb018 (diff)
downloadlinux-f5c779b7ddbda30866cf2a27c63e34158f858c73.tar.xz
ksmbd: fix racy issue from session setup and logoff
This racy issue is triggered by sending concurrent session setup and logoff requests. This patch does not set connection status as KSMBD_SESS_GOOD if state is KSMBD_SESS_NEED_RECONNECT in session setup. And relookup session to validate if session is deleted in logoff. Cc: stable@vger.kernel.org Reported-by: zdi-disclosures@trendmicro.com # ZDI-CAN-20481, ZDI-CAN-20590, ZDI-CAN-20596 Signed-off-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/ksmbd/server.c')
-rw-r--r--fs/ksmbd/server.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/ksmbd/server.c b/fs/ksmbd/server.c
index 0979577fd23e..2ebf6985a88d 100644
--- a/fs/ksmbd/server.c
+++ b/fs/ksmbd/server.c
@@ -93,7 +93,8 @@ static inline int check_conn_state(struct ksmbd_work *work)
{
struct smb_hdr *rsp_hdr;
- if (ksmbd_conn_exiting(work) || ksmbd_conn_need_reconnect(work)) {
+ if (ksmbd_conn_exiting(work->conn) ||
+ ksmbd_conn_need_reconnect(work->conn)) {
rsp_hdr = work->response_buf;
rsp_hdr->Status.CifsError = STATUS_CONNECTION_DISCONNECTED;
return 1;