active_mm in the exec() path can be for an unrelated thread, so the oom_disable_count logic should use old_mm instead. Reported-by: KOSAKI Motohiro <kosaki.motohiro@xxxxxxxxxxxxxx> Signed-off-by: David Rientjes <rientjes@xxxxxxxxxx> --- fs/exec.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/exec.c b/fs/exec.c --- a/fs/exec.c +++ b/fs/exec.c @@ -752,8 +752,8 @@ static int exec_mmap(struct mm_struct *mm) tsk->mm = mm; tsk->active_mm = mm; activate_mm(active_mm, mm); - if (tsk->signal->oom_score_adj == OOM_SCORE_ADJ_MIN) { - atomic_dec(&active_mm->oom_disable_count); + if (old_mm && tsk->signal->oom_score_adj == OOM_SCORE_ADJ_MIN) { + atomic_dec(&old_mm->oom_disable_count); atomic_inc(&tsk->mm->oom_disable_count); } task_unlock(tsk); -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxxx For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>