Skip to content

Commit

Permalink
mm/mempolicy.c: fix wrong sp_node insertion
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: KOSAKI Motohiro <[email protected]>
Cc: Sasha Levin <[email protected]>
Cc: Hugh Dickins <[email protected]>
Cc: Mel Gorman <[email protected]>
Cc: Dave Jones <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Hillf Danton authored and torvalds committed Mar 8, 2013
1 parent 88b9e45 commit 5ca3957
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mm/mempolicy.c
Original file line number Diff line number Diff line change
Expand Up @@ -2391,8 +2391,8 @@ static int shared_policy_replace(struct shared_policy *sp, unsigned long start,
*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;
Expand Down

0 comments on commit 5ca3957

Please sign in to comment.