]> git.ipfire.org Git - people/arne_f/kernel.git/commit
libnvdimm, dimm: fix dpa reservation vs uninitialized label area
authorDan Williams <dan.j.williams@intel.com>
Fri, 6 Apr 2018 18:25:38 +0000 (11:25 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 24 Apr 2018 07:43:02 +0000 (09:43 +0200)
commitaf5bb27195ef623d3de2eedd9baaf1b225e6b566
treec1aa3d40796f2644dc7e75585998452dec2af216
parentcc76ab2e932cc9633f40bb265784269cc2c9e4ab
libnvdimm, dimm: fix dpa reservation vs uninitialized label area

commit c31898c8c711f2bbbcaebe802a55827e288d875a upstream.

At initialization time the 'dimm' driver caches a copy of the memory
device's label area and reserves address space for each of the
namespaces defined.

However, as can be seen below, the reservation occurs even when the
index blocks are invalid:

 nvdimm nmem0: nvdimm_init_config_data: len: 131072 rc: 0
 nvdimm nmem0: config data size: 131072
 nvdimm nmem0: __nd_label_validate: nsindex0 labelsize 1 invalid
 nvdimm nmem0: __nd_label_validate: nsindex1 labelsize 1 invalid
 nvdimm nmem0: : pmem-6025e505: 0x1000000000 @ 0xf50000000 reserve <-- bad

Gate dpa reservation on the presence of valid index blocks.

Cc: <stable@vger.kernel.org>
Fixes: 4a826c83db4e ("libnvdimm: namespace indices: read and validate")
Reported-by: Krzysztof Rusocki <krzysztof.rusocki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/nvdimm/dimm.c