From: Hillf Danton Date: Fri, 8 Mar 2013 20:43:28 +0000 (-0800) Subject: mm/mempolicy.c: fix wrong sp_node insertion X-Git-Tag: v3.8.3~37 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=87b07931632bc4a4c032a49b2fb00701ecef6320;p=karo-tx-linux.git 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 Signed-off-by: KOSAKI Motohiro Cc: Sasha Levin Cc: Hugh Dickins Cc: Mel Gorman Cc: Dave Jones Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- diff --git a/mm/mempolicy.c b/mm/mempolicy.c index e2df1c1fb41f..3df6d12e8ff8 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;