aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHillf Danton <dhillf@gmail.com>2013-03-08 12:43:28 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-03-14 11:26:25 -0700
commit87b07931632bc4a4c032a49b2fb00701ecef6320 (patch)
treed851f5fc5bc925f9fa485d6ecf07432c6f175614
parent3479cfd6f589c4d49494c046fabdbfdcb5c4c8e6 (diff)
mm/mempolicy.c: fix wrong sp_node insertion
commit 5ca3957510b9fc2a14d3647db518014842f9a2b4 upstream. n->end is accessed in sp_insert(). Thus it should be update before calling sp_insert(). This mistake may make kernel panic. Signed-off-by: Hillf Danton <dhillf@gmail.com> Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Cc: Sasha Levin <sasha.levin@oracle.com> Cc: Hugh Dickins <hughd@google.com> Cc: Mel Gorman <mgorman@suse.de> Cc: Dave Jones <davej@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--mm/mempolicy.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index e2df1c1fb41..3df6d12e8ff 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -2386,8 +2386,8 @@ restart:
*mpol_new = *n->policy;
atomic_set(&mpol_new->refcnt, 1);
sp_node_init(n_new, n->end, end, mpol_new);
- sp_insert(sp, n_new);
n->end = start;
+ sp_insert(sp, n_new);
n_new = NULL;
mpol_new = NULL;
break;