Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d3a532a9 authored by Anton Vorontsov's avatar Anton Vorontsov Committed by Greg Kroah-Hartman
Browse files

sysrq: Properly check for kernel threads



There's a real possibility of killing kernel threads that might
have issued use_mm(), so kthread's mm might become non-NULL.

This patch fixes the issue by checking for PF_KTHREAD (just as
get_task_mm()).

Suggested-by: default avatarOleg Nesterov <oleg@redhat.com>
Signed-off-by: default avatarAnton Vorontsov <anton.vorontsov@linaro.org>
Acked-by: default avatarDavid Rientjes <rientjes@google.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e502babe
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -324,8 +324,11 @@ static void send_sig_all(int sig)

	read_lock(&tasklist_lock);
	for_each_process(p) {
		if (p->mm && !is_global_init(p))
			/* Not swapper, init nor kernel thread */
		if (p->flags & PF_KTHREAD)
			continue;
		if (is_global_init(p))
			continue;

		force_sig(sig, p);
	}
	read_unlock(&tasklist_lock);