[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1338656062-25008-1-git-send-email-siddhesh.poyarekar@gmail.com>
Date: Sat, 2 Jun 2012 22:24:22 +0530
From: Siddhesh Poyarekar <siddhesh.poyarekar@...il.com>
To: linux-kernel@...r.kernel.org
Cc: Oleg Nesterov <oleg@...hat.com>, Tejun Heo <tj@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
David Howells <dhowells@...hat.com>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Siddhesh Poyarekar <siddhesh.poyarekar@...il.com>
Subject: [PATCH] Avoid dereferencing a possibly NULL mm
The NULL check for mm in exit_mm occurs after mm_release is
called. This looks wrong because mm_release dereferences mm:
...
if (!(tsk->flags & PF_SIGNALED) &&
atomic_read(&mm->mm_users) > 1) {
/*
...
This dereference seems unsafe and hence is fixed by moving the NULL
check above mm_release.
Signed-off-by: Siddhesh Poyarekar <siddhesh.poyarekar@...il.com>
---
kernel/exit.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/kernel/exit.c b/kernel/exit.c
index 34867cc..15fe63c 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -640,9 +640,11 @@ static void exit_mm(struct task_struct * tsk)
struct mm_struct *mm = tsk->mm;
struct core_state *core_state;
- mm_release(tsk, mm);
if (!mm)
return;
+
+ mm_release(tsk, mm);
+
/*
* Serialize with any possible pending coredump.
* We must hold mmap_sem around checking core_state
--
1.7.7.6
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists