Oleg Nesterov b95c35e76b oom: fix the unsafe usage of badness() in proc_oom_score()
proc_oom_score(task) has a reference to task_struct, but that is all.
If this task was already released before we take tasklist_lock

	- we can't use task->group_leader, it points to nowhere

	- it is not safe to call badness() even if this task is
	  ->group_leader, has_intersects_mems_allowed() assumes
	  it is safe to iterate over ->thread_group list.

	- even worse, badness() can hit ->signal == NULL

Add the pid_alive() check to ensure __unhash_process() was not called.

Also, use "task" instead of task->group_leader. badness() should return
the same result for any sub-thread. Currently this is not true, but
this should be changed anyway.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-04-01 08:50:21 -07:00
..
2010-03-22 09:57:19 -07:00
2010-02-07 03:06:21 -05:00
2010-01-14 09:05:42 -05:00
2010-01-19 22:36:06 -06:00
2009-06-17 00:36:36 -04:00
2009-07-12 12:22:34 -07:00
2010-03-29 21:14:52 +02:00
2010-02-19 03:35:12 -05:00
2010-03-17 18:43:47 -07:00
2010-01-26 22:22:26 -05:00
2010-03-12 15:52:35 -08:00
2009-12-16 07:20:13 -08:00
2010-03-06 11:26:29 -08:00
2010-03-06 11:26:29 -08:00
2010-03-08 16:55:37 +01:00
2009-09-24 07:21:03 -07:00
2010-03-12 15:52:32 -08:00
2010-03-03 14:13:08 -05:00
2009-12-17 04:52:13 -05:00
2010-03-06 11:26:29 -08:00
2010-03-06 11:26:29 -08:00
2010-03-03 14:07:59 -05:00
2010-03-08 16:55:37 +01:00
2009-12-17 10:51:40 -05:00
2010-03-12 15:52:32 -08:00
2010-03-03 14:08:00 -05:00
2009-12-16 12:16:49 -05:00