projects/linux·commit c71370bd

Merge tag 'interrupting_kthread_stop-for-v5.20' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace

c71370bd · Linus Torvalds <[email protected]> · 2022-10-09 16:01:59 -07:00

Pull kthread update from Eric Biederman:
 "Break out of wait loops on kthread_stop()

  This is a small tweak to kthread_stop so it breaks out of
  interruptible waits, that don't explicitly test for kthread_stop.

  These interruptible waits occassionaly occur in kernel threads do to
  code sharing"

* tag 'interrupting_kthread_stop-for-v5.20' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace:
  signal: break out of wait loops on kthread_stop()
Commit
c71370bde7dbd3aefae0c2e8dd643d68fb2c51c8
Parents
4899a36f · a7c01fa9

Merge commit. Changes below are compared with the first parent: 4899a36f.

Changes

1 files changed · +1 −0

FileStatusAddDelContent
kernel/kthread.cmodified+1−0View file

kernel/kthread.c

View file
diff --git a/kernel/kthread.c b/kernel/kthread.c
index 28a6b7a..f97fd01 100644
--- a/kernel/kthread.c
+++ b/kernel/kthread.c
@@ -704,6 +704,7 @@ int kthread_stop(struct task_struct *k)
kthread = to_kthread(k);
set_bit(KTHREAD_SHOULD_STOP, &kthread->flags);
kthread_unpark(k);
+ set_tsk_thread_flag(k, TIF_NOTIFY_SIGNAL);
wake_up_process(k);
wait_for_completion(&kthread->exited);
ret = kthread->result;