Skip to content

Commit

Permalink
ksmbd: block asynchronous requests when making a delay on session setup
Browse files Browse the repository at this point in the history
commit b096d97 upstream.

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>
  • Loading branch information
namjaejeon authored and gregkh committed May 11, 2023
1 parent 02f41d8 commit a1fdf5e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fs/ksmbd/smb2pdu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1874,8 +1874,11 @@ int smb2_sess_setup(struct ksmbd_work *work)
try_delay = true;

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);
}
}
}

Expand Down

0 comments on commit a1fdf5e

Please sign in to comment.