ksmbd: fix deadlock in ksmbd_find_crypto_ctx()
authorNamjae Jeon <linkinjeon@kernel.org>
Tue, 2 May 2023 23:44:14 +0000 (08:44 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 11 May 2023 14:03:04 +0000 (23:03 +0900)
commit18973b73fa5177b5ac3c0eb81d2fe093452ecaa9
tree543a4417ae17c24c1e40729b836403fc7a713226
parent1f0490586544455e5be698be2e6c30077b4ec461
ksmbd: fix deadlock in ksmbd_find_crypto_ctx()

commit 7b4323373d844954bb76e0e9f39c4e5fc785fa7b upstream.

Deadlock is triggered by sending multiple concurrent session setup
requests. It should be reused after releasing when getting ctx for crypto.
Multiple consecutive ctx uses cause deadlock while waiting for releasing
due to the limited number of ctx.

Cc: stable@vger.kernel.org
Reported-by: zdi-disclosures@trendmicro.com # ZDI-CAN-20591
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/auth.c