ksmbd: fix race condition from parallel smb2 logoff requests
authorNamjae Jeon <linkinjeon@kernel.org>
Wed, 4 Oct 2023 09:30:14 +0000 (18:30 +0900)
committerSteve French <stfrench@microsoft.com>
Thu, 5 Oct 2023 01:21:48 +0000 (20:21 -0500)
commit7ca9da7d873ee8024e9548d3366101c2b6843eab
treeba0c28bb371ba3c7bf09de259470433e2d911d36
parentc69813471a1ec081a0b9bf0c6bd7e8afd818afce
ksmbd: fix race condition from parallel smb2 logoff requests

If parallel smb2 logoff requests come in before closing door, running
request count becomes more than 1 even though connection status is set to
KSMBD_SESS_NEED_RECONNECT. It can't get condition true, and sleep forever.
This patch fix race condition problem by returning error if connection
status was already set to KSMBD_SESS_NEED_RECONNECT.

Reported-by: luosili <rootlab@huawei.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/server/smb2pdu.c