cifs: fix session state check in reconnect to avoid use-after-free issue
authorWinston Wen <wentao@uniontech.com>
Mon, 26 Jun 2023 03:42:56 +0000 (11:42 +0800)
committerSteve French <stfrench@microsoft.com>
Wed, 28 Jun 2023 16:47:43 +0000 (11:47 -0500)
commit99f280700b4cc02d5f141b8d15f8e9fad0418f65
tree84f9cfb541e42f7ef8f5400dd7fbac801e449dad
parent326a8d04f147e2bf393f6f9cdb74126ee6900607
cifs: fix session state check in reconnect to avoid use-after-free issue

Don't collect exiting session in smb2_reconnect_server(), because it
will be released soon.

Note that the exiting session will stay in server->smb_ses_list until
it complete the cifs_free_ipc() and logoff() and then delete itself
from the list.

Signed-off-by: Winston Wen <wentao@uniontech.com>
Reviewed-by: Shyam Prasad N <sprasad@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/smb2pdu.c