From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755600AbcHWUmU (ORCPT ); Tue, 23 Aug 2016 16:42:20 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:51372 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753501AbcHWUmS (ORCPT ); Tue, 23 Aug 2016 16:42:18 -0400 Date: Tue, 23 Aug 2016 13:42:16 -0700 From: Andrew Morton To: Toshi Kani Cc: dan.j.williams@intel.com, m.abhilash-kumar@hpe.com, linux-nvdimm@ml01.01.org, linux-kernel@vger.kernel.org, Ard Biesheuvel , Brian Starkey Subject: Re: [PATCH] memremap: Fix NULL pointer BUG in get_zone_device_page() Message-Id: <20160823134216.8f8e8944581fe1ae202377d1@linux-foundation.org> In-Reply-To: <1471977800-12688-1-git-send-email-toshi.kani@hpe.com> References: <1471977800-12688-1-git-send-email-toshi.kani@hpe.com> X-Mailer: Sylpheed 3.4.1 (GTK+ 2.24.23; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 23 Aug 2016 12:43:20 -0600 Toshi Kani wrote: > The following BUG was observed while starting up KVM with nvdimm > device as memory-backend-file to /dev/dax. > > BUG: unable to handle kernel NULL pointer dereference at 0000000000000008 > > ... > > devm_memremap_pages() calls for_each_device_pfn() to walk through > all pfns in page_map. pfn_first(), however, returns a wrong pfn > that leaves page->pgmap uninitialized. > > Since arch_add_memory() has set up direct mappings to the NVDIMM > range with altmap, pfn_first() should not modify the start pfn. > Change pfn_first() to simply return pfn of res->start. Which kernel version(s) do you think need fixing?