diff options
author | 2020-10-17 15:10:54 +0000 | |
---|---|---|
committer | 2020-10-17 15:10:54 +0000 | |
commit | 8224282cb46b0d0672055a2c653f015bfd9ea66d (patch) | |
tree | 90d1b605a772dd4f5110ddb350b1ef21d44e5135 /sys/dev/pci/drm/drm_linux.c | |
parent | Update to tzdata2020c from www.iana.org. (diff) | |
download | wireguard-openbsd-8224282cb46b0d0672055a2c653f015bfd9ea66d.tar.xz wireguard-openbsd-8224282cb46b0d0672055a2c653f015bfd9ea66d.zip |
Avoid a possible dead-lock in kthread_stop(): when stopping, wakeup()
the caller of kthread_stop().
The thread should also be unparked as else it will not seen the
KTHREAD_SHOULDSTOP flag. it follows what Linux is doing.
ok kettenis@
Diffstat (limited to 'sys/dev/pci/drm/drm_linux.c')
-rw-r--r-- | sys/dev/pci/drm/drm_linux.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/dev/pci/drm/drm_linux.c b/sys/dev/pci/drm/drm_linux.c index fd797effc74..25282df374a 100644 --- a/sys/dev/pci/drm/drm_linux.c +++ b/sys/dev/pci/drm/drm_linux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: drm_linux.c,v 1.64 2020/10/16 09:20:04 jsg Exp $ */ +/* $OpenBSD: drm_linux.c,v 1.65 2020/10/17 15:10:54 semarie Exp $ */ /* * Copyright (c) 2013 Jonathan Gray <jsg@openbsd.org> * Copyright (c) 2015, 2016 Mark Kettenis <kettenis@openbsd.org> @@ -207,6 +207,7 @@ kthread_func(void *arg) ret = thread->func(thread->data); thread->flags |= KTHREAD_STOPPED; + wakeup(thread); kthread_exit(ret); } @@ -298,6 +299,7 @@ kthread_stop(struct proc *p) while ((thread->flags & KTHREAD_STOPPED) == 0) { thread->flags |= KTHREAD_SHOULDSTOP; + kthread_unpark(p); wake_up_process(thread->proc); tsleep_nsec(thread, PPAUSE, "stop", INFSLP); } |