From: Hillf Danton <[email protected]>
Subject: 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 <[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]>
---

 mm/mempolicy.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN mm/mempolicy.c~mm-mempolicyc-fix-wrong-sp_node-insertion 
mm/mempolicy.c
--- a/mm/mempolicy.c~mm-mempolicyc-fix-wrong-sp_node-insertion
+++ a/mm/mempolicy.c
@@ -2391,8 +2391,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;
_
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to