Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 91ed7ac4 authored by Dan Williams's avatar Dan Williams
Browse files

libnvdimm, pmem: Fix badblocks population for 'raw' namespaces



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: e8d51348 ("memremap: change devm_memremap_pages interface...")
Cc: <stable@vger.kernel.org>
Cc: Christoph Hellwig <hch@lst.de>
Reported-by: default avatarJacek Zloch <jacek.zloch@intel.com>
Reported-by: default avatarKrzysztof Rusocki <krzysztof.rusocki@intel.com>
Reviewed-by: default avatarVishal Verma <vishal.l.verma@intel.com>
Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent 55781b66
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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