ksmbd: smbd: fix kernel oops during server shutdown

if server shutdown happens in the situation that
there are connections, workqueue could be destroyed
before queueing disconnect work.

Signed-off-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
Hyunchul Lee 2021-08-12 10:23:08 +09:00 committed by Namjae Jeon
parent 777cad1604
commit 323b1ea102
1 changed files with 3 additions and 2 deletions

View File

@ -329,6 +329,7 @@ static void smb_direct_disconnect_rdma_work(struct work_struct *work)
static void
smb_direct_disconnect_rdma_connection(struct smb_direct_transport *t)
{
if (t->status == SMB_DIRECT_CS_CONNECTED)
queue_work(smb_direct_wq, &t->disconnect_work);
}
@ -1415,7 +1416,7 @@ static void smb_direct_disconnect(struct ksmbd_transport *t)
ksmbd_debug(RDMA, "Disconnecting cm_id=%p\n", st->cm_id);
smb_direct_disconnect_rdma_connection(st);
smb_direct_disconnect_rdma_work(&st->disconnect_work);
wait_event_interruptible(st->wait_status,
st->status == SMB_DIRECT_CS_DISCONNECTED);
free_transport(st);