]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ksmbd: block asynchronous requests when making a delay on session setup
authorNamjae Jeon <linkinjeon@kernel.org>
Mon, 18 Dec 2023 15:33:50 +0000 (00:33 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 23 Dec 2023 09:41:55 +0000 (10:41 +0100)
[ Upstream commit b096d97f47326b1e2dbdef1c91fab69ffda54d17 ]

ksmbd make a delay of 5 seconds on session setup to avoid dictionary
attacks. But the 5 seconds delay can be bypassed by using asynchronous
requests. This patch block all requests on current connection when
making a delay on sesstion setup failure.

Cc: stable@vger.kernel.org
Reported-by: zdi-disclosures@trendmicro.com # ZDI-CAN-20482
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ksmbd/smb2pdu.c

index 3fe827e1584a0832a749f85cbc9b9ba948c17e09..2216ff1d810f4726e14a167f531ca7e1dd5b2825 100644 (file)
@@ -1877,8 +1877,11 @@ out_err:
 
                        sess->last_active = jiffies;
                        sess->state = SMB2_SESSION_EXPIRED;
-                       if (try_delay)
+                       if (try_delay) {
+                               ksmbd_conn_set_need_reconnect(conn);
                                ssleep(5);
+                               ksmbd_conn_set_need_negotiate(conn);
+                       }
                }
        }