Commit 5ca3957510b9fc2a14d3647db518014842f9a2b4
Committed by
Linus Torvalds
1 parent
88b9e456b1
Exists in
master
and in
20 other branches
mm/mempolicy.c: fix wrong sp_node insertion
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> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff
mm/mempolicy.c
... | ... | @@ -2391,8 +2391,8 @@ |
2391 | 2391 | *mpol_new = *n->policy; |
2392 | 2392 | atomic_set(&mpol_new->refcnt, 1); |
2393 | 2393 | sp_node_init(n_new, n->end, end, mpol_new); |
2394 | - sp_insert(sp, n_new); | |
2395 | 2394 | n->end = start; |
2395 | + sp_insert(sp, n_new); | |
2396 | 2396 | n_new = NULL; |
2397 | 2397 | mpol_new = NULL; |
2398 | 2398 | break; |