Received: by 10.192.165.148 with SMTP id m20csp894957imm; Wed, 25 Apr 2018 09:15:14 -0700 (PDT) X-Google-Smtp-Source: AIpwx48Bh5cEsywUR+ZQksyxf1tw33YNSs8A8pNYf/+WS4Vk9b0eOmrlHBnsCB9zEtkVbWX/xwf2 X-Received: by 2002:a17:902:264:: with SMTP id 91-v6mr29545532plc.341.1524672914543; Wed, 25 Apr 2018 09:15:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524672914; cv=none; d=google.com; s=arc-20160816; b=ghbcLRaFtlDtQX6n49ThGIMXbfwFMlyih+Y055V+aip3lT1+jJjZlBWRHNNnZAc2QE cZvgb/OsRRJDxDHlwfAdGtzAS42wPsSKuYd7Aeo4EsdccGiAacfKer8XjWWbsQgwm380 dSNmWrmUCqO6L8o9J7BLHRu9Oev3YjV3vGyhdBuvh/EhAHtJFooMOm7W+ndrUVD5RDcK Ba6oeNXCJuzNIkeLS3/D2W2r46dkkjgAwUQeW0NBkbRFvbmUHhLWx1XimFxvcl7H1zba 0fA/kl2FefCs4OxRdvfbBlDiPZfpgLXwB1P5uKhNYaAgzy1bIr4Dhscmw/mvL5EBYjJr FqLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=BPTSuEnE6jlRHMSPU4M23tQO9MzVfPBbVxzFt35dOrY=; b=WKUxS577AN4ZoqAOwKJAJs3aBslGWDzw7jnvbfAVHCwkPus9WvL1+89LfjBd6aNw8a WXA7z1Ba4PwYev/95KmOfQLsDT5ZYNK5KRo1vNbYrLxd8fCWuxL8B4IDjtDu6atGPteD 2DRofIWJE6g8YxT+FoDJIx1i4uIbSgouUTH+d/+h4YqsNvyCZc9SZooLRyqRpFRMmrxY jsn5sSeJdubspB9/c3eNjWSaWnGM/KuYTzGUf6FarG1DglhtQeTl+Ve0+we5td3/8YWM KAnosjbmR1xmdWBvCHBqVOduwOEEibb9g+NDoBw/Y3cr0Rh9Sj+8o1UbQX4AegDMn2ST aVbA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a5-v6si16051618pla.117.2018.04.25.09.14.59; Wed, 25 Apr 2018 09:15:14 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755743AbeDYQMw (ORCPT + 99 others); Wed, 25 Apr 2018 12:12:52 -0400 Received: from g4t3425.houston.hpe.com ([15.241.140.78]:32197 "EHLO g4t3425.houston.hpe.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755253AbeDYQMT (ORCPT ); Wed, 25 Apr 2018 12:12:19 -0400 Received: from g4t3433.houston.hpecorp.net (g4t3433.houston.hpecorp.net [16.208.49.245]) by g4t3425.houston.hpe.com (Postfix) with ESMTP id 145E1D0; Wed, 25 Apr 2018 16:12:19 +0000 (UTC) Received: from misato.americas.hpqcorp.net (unknown [10.34.81.122]) by g4t3433.houston.hpecorp.net (Postfix) with ESMTP id 6CB669AA; Wed, 25 Apr 2018 16:12:18 +0000 (UTC) From: Toshi Kani To: dan.j.williams@intel.com Cc: linux-nvdimm@lists.01.org, linux-kernel@vger.kernel.org, Toshi Kani , Christoph Hellwig , stable@vger.kernel.org Subject: [PATCH] pmem: fix badblocks population for raw mode Date: Wed, 25 Apr 2018 10:11:25 -0600 Message-Id: <20180425161125.8082-1-toshi.kani@hpe.com> X-Mailer: git-send-email 2.14.3 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org pmem_attach_disk() calls nvdimm_badblocks_populate() with resource range uninitialized in the case of raw mode. This leads the pmem driver to hit MCE despite of ARS reporting the range bad. Initialize 'bb_res' for raw mode. Fixes: e8d513483300 ("memremap: change devm_memremap_pages interface to use struct dev_pagemap") Signed-off-by: Toshi Kani Cc: Christoph Hellwig Cc: Dan Williams Cc: --- 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 9d714926ecf5..2d7875209bce 100644 --- a/drivers/nvdimm/pmem.c +++ b/drivers/nvdimm/pmem.c @@ -367,9 +367,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, res, sizeof(bb_res)); + } /* * At release time the queue must be frozen before