diff options
author | Namjae Jeon <linkinjeon@kernel.org> | 2021-10-13 11:28:31 +0300 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2021-10-20 08:07:10 +0300 |
commit | 621be84a9d1fbf0097fd058e249ec5cc4f35f3c5 (patch) | |
tree | e6d922ce3d5262c34c781768ee51588ce4c80e2e /fs/ksmbd/mgmt | |
parent | 34061d6b76a41b1e43c19e1e50d98e5d77f77d4e (diff) | |
download | linux-621be84a9d1fbf0097fd058e249ec5cc4f35f3c5.tar.xz |
ksmbd: throttle session setup failures to avoid dictionary attacks
To avoid dictionary attacks (repeated session setups rapidly sent) to
connect to server, ksmbd make a delay of a 5 seconds on session setup
failure to make it harder to send enough random connection requests
to break into a server if a user insert the wrong password 10 times
in a row.
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/ksmbd/mgmt')
-rw-r--r-- | fs/ksmbd/mgmt/user_config.c | 2 | ||||
-rw-r--r-- | fs/ksmbd/mgmt/user_config.h | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/fs/ksmbd/mgmt/user_config.c b/fs/ksmbd/mgmt/user_config.c index d21629ae5c89..1019d3677d55 100644 --- a/fs/ksmbd/mgmt/user_config.c +++ b/fs/ksmbd/mgmt/user_config.c @@ -55,7 +55,7 @@ struct ksmbd_user *ksmbd_alloc_user(struct ksmbd_login_response *resp) void ksmbd_free_user(struct ksmbd_user *user) { - ksmbd_ipc_logout_request(user->name); + ksmbd_ipc_logout_request(user->name, user->flags); kfree(user->name); kfree(user->passkey); kfree(user); diff --git a/fs/ksmbd/mgmt/user_config.h b/fs/ksmbd/mgmt/user_config.h index b2bb074a0150..aff80b029579 100644 --- a/fs/ksmbd/mgmt/user_config.h +++ b/fs/ksmbd/mgmt/user_config.h @@ -18,6 +18,7 @@ struct ksmbd_user { size_t passkey_sz; char *passkey; + unsigned int failed_login_count; }; static inline bool user_guest(struct ksmbd_user *user) |