diff options
author | Dan Williams <dan.j.williams@intel.com> | 2018-10-04 16:32:08 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-11-13 11:08:42 -0800 |
commit | 6c1400b39151625c356e84d44c9e9bfb67109dbd (patch) | |
tree | e9d7faec8652e8aa462f15a44aa5c618c99d98a9 /drivers/nvdimm | |
parent | 8f696986dbf2f9034d90eff19cb29996b65cbf50 (diff) | |
download | linux-stable-6c1400b39151625c356e84d44c9e9bfb67109dbd.tar.gz linux-stable-6c1400b39151625c356e84d44c9e9bfb67109dbd.tar.bz2 linux-stable-6c1400b39151625c356e84d44c9e9bfb67109dbd.zip |
libnvdimm, pmem: Fix badblocks population for 'raw' namespaces
commit 91ed7ac444ef749603a95629a5ec483988c4f14b upstream.
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: <stable@vger.kernel.org>
Cc: Christoph Hellwig <hch@lst.de>
Reported-by: Jacek Zloch <jacek.zloch@intel.com>
Reported-by: Krzysztof Rusocki <krzysztof.rusocki@intel.com>
Reviewed-by: Vishal Verma <vishal.l.verma@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/nvdimm')
-rw-r--r-- | drivers/nvdimm/pmem.c | 4 |
1 files changed, 3 insertions, 1 deletions
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 |