ksmbd: block asynchronous requests when making a delay on session setup
authorNamjae Jeon <linkinjeon@kernel.org>
Tue, 2 May 2023 23:43:30 +0000 (08:43 +0900)
committerSteve French <stfrench@microsoft.com>
Thu, 4 May 2023 04:03:01 +0000 (23:03 -0500)
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>
fs/ksmbd/smb2pdu.c

index 51cc1df..234ab5f 100644 (file)
@@ -1840,8 +1840,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);
+                       }
                }
        }