From patchwork Mon Oct 13 18:42:00 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Fontenot X-Patchwork-Id: 4333 X-Patchwork-Delegate: benh@kernel.crashing.org Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 5C607DE715 for ; Tue, 14 Oct 2008 07:18:41 +1100 (EST) X-Original-To: linuxppc-dev@ozlabs.org Delivered-To: linuxppc-dev@ozlabs.org Received: from e4.ny.us.ibm.com (e4.ny.us.ibm.com [32.97.182.144]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "e4.ny.us.ibm.com", Issuer "Equifax" (verified OK)) by ozlabs.org (Postfix) with ESMTPS id 359BFDDF3A for ; Tue, 14 Oct 2008 07:18:25 +1100 (EST) Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by e4.ny.us.ibm.com (8.13.8/8.13.8) with ESMTP id m9DKIN0Q001252 for ; Mon, 13 Oct 2008 16:18:23 -0400 Received: from d01av04.pok.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id m9DKIMSs237660 for ; Mon, 13 Oct 2008 16:18:22 -0400 Received: from d01av04.pok.ibm.com (loopback [127.0.0.1]) by d01av04.pok.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m9DKIMWA024141 for ; Mon, 13 Oct 2008 16:18:22 -0400 Received: from austin.ibm.com (netmail2.austin.ibm.com [9.41.248.176]) by d01av04.pok.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id m9DKHmdk021459 for ; Mon, 13 Oct 2008 16:18:22 -0400 Received: from [9.53.40.162] (mudbug-009053040162.austin.ibm.com [9.53.40.162]) by austin.ibm.com (8.13.8/8.12.10) with ESMTP id m9DIfxjO041498; Mon, 13 Oct 2008 13:41:59 -0500 Message-ID: <48F39678.9000604@austin.ibm.com> Date: Mon, 13 Oct 2008 13:42:00 -0500 From: Nathan Fontenot User-Agent: Thunderbird 2.0.0.17 (X11/20080925) MIME-Version: 1.0 To: linuxppc-dev@ozlabs.org Subject: [PATCH] powerpc: pseries_remove_lmb() should validate pfn Cc: Badari Pulavarty X-BeenThere: linuxppc-dev@ozlabs.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org The pfn of the memory to be removed should be validated prior to attempting to remove the memory. In cases where the probe of a memory section fails during hotplug add, the pfn for the lmb may not be valid. Signed-off-by: Badari Pulavarty Signed-off-by: Nathan Fontenot --- linux-2.6.orig/arch/powerpc/platforms/pseries/hotplug-memory.c 2008-10-01 14:20:08.000000000 -0500 +++ linux-2.6/arch/powerpc/platforms/pseries/hotplug-memory.c 2008-10-13 13:19:49.000000000 -0500 @@ -22,6 +22,12 @@ int ret; start_pfn = base >> PAGE_SHIFT; + + if (!pfn_valid(start_pfn)) { + lmb_remove(base, lmb_size); + return 0; + } + zone = page_zone(pfn_to_page(start_pfn)); /*