From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751137Ab3B1FZd (ORCPT ); Thu, 28 Feb 2013 00:25:33 -0500 Received: from mail-qe0-f42.google.com ([209.85.128.42]:57343 "EHLO mail-qe0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750738Ab3B1FZc (ORCPT ); Thu, 28 Feb 2013 00:25:32 -0500 From: kosaki.motohiro@gmail.com To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, Sasha Levin , Andrew Morton , Hugh Dickins , Mel Gorman , Dave Jones , Hillf Danton , KOSAKI Motohiro Subject: [PATCH 1/2] mempolicy: fix wrong sp_node insertion Date: Thu, 28 Feb 2013 00:25:06 -0500 Message-Id: <1362029107-3908-1-git-send-email-kosaki.motohiro@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: KOSAKI Motohiro From: Hillf Danton 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 --- mm/mempolicy.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 31d2663..868d08f 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -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; -- 1.7.1