summaryrefslogtreecommitdiffstats
path: root/fs/ksmbd/transport_tcp.c
diff options
context:
space:
mode:
authorNamjae Jeon <linkinjeon@kernel.org>2023-05-03 09:45:00 +0200
committerSteve French <stfrench@microsoft.com>2023-05-04 06:03:01 +0200
commitf5c779b7ddbda30866cf2a27c63e34158f858c73 (patch)
treed306574cebf6e016eb339ec2bf44515f7eaac7cb /fs/ksmbd/transport_tcp.c
parentksmbd: fix NULL pointer dereference in smb2_get_info_filesystem() (diff)
downloadlinux-f5c779b7ddbda30866cf2a27c63e34158f858c73.tar.xz
linux-f5c779b7ddbda30866cf2a27c63e34158f858c73.zip
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/transport_tcp.c')
-rw-r--r--fs/ksmbd/transport_tcp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ksmbd/transport_tcp.c b/fs/ksmbd/transport_tcp.c
index 20e85e2701f2..eff7a1d793f0 100644
--- a/fs/ksmbd/transport_tcp.c
+++ b/fs/ksmbd/transport_tcp.c
@@ -333,7 +333,7 @@ static int ksmbd_tcp_readv(struct tcp_transport *t, struct kvec *iov_orig,
if (length == -EINTR) {
total_read = -ESHUTDOWN;
break;
- } else if (conn->status == KSMBD_SESS_NEED_RECONNECT) {
+ } else if (ksmbd_conn_need_reconnect(conn)) {
total_read = -EAGAIN;
break;
} else if (length == -ERESTARTSYS || length == -EAGAIN) {