]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
libnvdimm, pmem: Fix badblocks population for 'raw' namespaces
authorDan Williams <dan.j.williams@intel.com>
Thu, 4 Oct 2018 23:32:08 +0000 (16:32 -0700)
committerDan Williams <dan.j.williams@intel.com>
Tue, 9 Oct 2018 07:04:56 +0000 (00:04 -0700)
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>
drivers/nvdimm/pmem.c

index 6071e2942053c903564d6f08f278d3735a619308..2082ae01b9c8755c8eb52e49ca283d9071ec1db2 100644 (file)
@@ -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