Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp23287imm; Thu, 4 Oct 2018 17:09:10 -0700 (PDT) X-Google-Smtp-Source: ACcGV63Osdkp+VNWK1tLWJGjhyRvY6h03/buexEGCADPFTxE7wMR7YLJ3pvnWmat4DSMeovkgr9u X-Received: by 2002:a62:579c:: with SMTP id i28-v6mr9009265pfj.158.1538698150214; Thu, 04 Oct 2018 17:09:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538698150; cv=none; d=google.com; s=arc-20160816; b=ziz5u8C4YKlBHl5Ph1cuw/YjfmXY64ukS5qkT6SxezWWrhvVZ+45DJgPtWIIZ0xGL+ 6D80uYoNl8fhpseeREG12WDERnaqwA/IPgyTKEkywwd9uf8PNvTLUPJb9zszIRODMM6f cuX8J86HuoE3GoGmiBCyejfSRLXTXhf8REHPaU3uhQjY+sf22bEls9wUk3PZphA7OKPr bmXaQ9FG3tJ8kxMjO6J8biXuiinKoWgFZl0zKWwnb7a59kgNMZCbUrhEk69PqA/pEieu fvkhloPNLaFjEPX/i/Q5R23L9Qy3Mqli+z6B8jcv85uH5JDSmD+ZKxwz312Mn/unBOsA mimA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:message-id:date:cc:to:from:subject; bh=nFJN54PxdUoL5RsUybiyvszgewh3BN+4CHW4Up1mcvE=; b=WlYaUWsAK2HerxlU0k548fCPNIS213fMUxVvzwRvN/cXgm5u99kMsNGkOOO7s1YcYo pg0ZJ7vmkULBC511O8EZGtEIbjotTjS0rT81on1PG/dZBcCvkeVW4V52ug7HE2Jtlof8 ADKqTuLnbw/zwVkNLRZdUoEfgke/6psPDs9SLutY+NyXr+WcbTmSfTFQz/EP9cwwuMRq HJnqNddEz0R0+7wpe+OizH7BdD0MH8bTRuq16uZFadxw/K+MTfQO2XP/nT68BhSPJet9 VjoIWgodSL7ORHuLvXawQ9z9h3DrI9yhJ7W1kRILDWgfODeqSrU8V3fKnaze+V0LoeCm nSEg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v11-v6si7351044plg.18.2018.10.04.17.08.48; Thu, 04 Oct 2018 17:09:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727121AbeJEHEh (ORCPT + 99 others); Fri, 5 Oct 2018 03:04:37 -0400 Received: from mga11.intel.com ([192.55.52.93]:63004 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725998AbeJEHEg (ORCPT ); Fri, 5 Oct 2018 03:04:36 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Oct 2018 17:08:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,342,1534834800"; d="scan'208";a="94760662" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.16]) by fmsmga004.fm.intel.com with ESMTP; 04 Oct 2018 17:08:25 -0700 Subject: [PATCH] libnvdimm, pmem: Fix badblocks population for 'raw' namespaces From: Dan Williams To: linux-nvdimm@lists.01.org Cc: stable@vger.kernel.org, Christoph Hellwig , Jacek Zloch , Krzysztof Rusocki , linux-kernel@vger.kernel.org Date: Thu, 04 Oct 2018 16:56:37 -0700 Message-ID: <153869739732.2904401.10895695693942634646.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.18-2-gc94f MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The driver is only initializing bb_res in the devm_memremap_pages() paths, but the raw namespace case is passing an uninitialized bb_res to nvdimm_badblocks_populate(). Fixes: e8d513483300 ("memremap: change devm_memremap_pages interface...") Cc: Cc: Christoph Hellwig Reported-by: Jacek Zloch Reported-by: Krzysztof Rusocki Signed-off-by: Dan Williams --- drivers/nvdimm/pmem.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c index 6071e2942053..2082ae01b9c8 100644 --- a/drivers/nvdimm/pmem.c +++ b/drivers/nvdimm/pmem.c @@ -421,9 +421,11 @@ static int pmem_attach_disk(struct device *dev, addr = devm_memremap_pages(dev, &pmem->pgmap); pmem->pfn_flags |= PFN_MAP; memcpy(&bb_res, &pmem->pgmap.res, sizeof(bb_res)); - } else + } else { addr = devm_memremap(dev, pmem->phys_addr, pmem->size, ARCH_MEMREMAP_PMEM); + memcpy(&bb_res, &nsio->res, sizeof(bb_res)); + } /* * At release time the queue must be frozen before