summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorHyunchul Lee <hyc.lee@gmail.com>2021-08-12 03:23:08 +0200
committerNamjae Jeon <namjae.jeon@samsung.com>2021-08-13 01:18:13 +0200
commit323b1ea10263e5f11c9fb12e25f6d8beb327228c (patch)
tree4ed839c183251aedc19c67ce844257957655258d /fs
parentksmbd: remove select FS_POSIX_ACL in Kconfig (diff)
downloadlinux-323b1ea10263e5f11c9fb12e25f6d8beb327228c.tar.xz
linux-323b1ea10263e5f11c9fb12e25f6d8beb327228c.zip
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>
Diffstat (limited to 'fs')
-rw-r--r--fs/ksmbd/transport_rdma.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/ksmbd/transport_rdma.c b/fs/ksmbd/transport_rdma.c
index f2ae6bae83f1..58f530056ac0 100644
--- a/fs/ksmbd/transport_rdma.c
+++ b/fs/ksmbd/transport_rdma.c
@@ -329,7 +329,8 @@ static void smb_direct_disconnect_rdma_work(struct work_struct *work)
static void
smb_direct_disconnect_rdma_connection(struct smb_direct_transport *t)
{
- queue_work(smb_direct_wq, &t->disconnect_work);
+ if (t->status == SMB_DIRECT_CS_CONNECTED)
+ queue_work(smb_direct_wq, &t->disconnect_work);
}
static void smb_direct_send_immediate_work(struct work_struct *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);