aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2017-09-18 17:48:58 -0400
committerDan Williams <dan.j.williams@intel.com>2017-09-18 20:29:01 -0400
commit33a56086712561b8b9cdc881e0317f4c36861f72 (patch)
tree34cc2c124accee1b2b38b803925e2ce5c832d41d
parent5e75fe3927559505682b0053b5745e3f42d66e8c (diff)
libnvdimm, namespace: fix btt claim class crash
Maurice reports: BUG: unable to handle kernel NULL pointer dereference at 0000000000000028 IP: holder_class_store+0x253/0x2b0 [libnvdimm] ...while trying to reconfigure an NVDIMM-N namespace into 'sector' / 'btt' mode. The crash points to this line: (gdb) li *(holder_class_store+0x253) 0x7773 is in holder_class_store (drivers/nvdimm/namespace_devs.c:1420). 1415 for (i = 0; i < nd_region->ndr_mappings; i++) { 1416 struct nd_mapping *nd_mapping = &nd_region->mapping[i]; 1417 struct nvdimm_drvdata *ndd = to_ndd(nd_mapping); 1418 struct nd_namespace_index *nsindex; 1419 1420 nsindex = to_namespace_index(ndd, ndd->ns_current); ...where we are failing because ndd is NULL due to NVDIMM-N dimms not supporting labels. Long story short, default to the BTTv1 format in the label-less / NVDIMM-N case. Fixes: 14e494542636 ("libnvdimm, btt: BTT updates for UEFI 2.7 format") Cc: <stable@vger.kernel.org> Cc: Vishal Verma <vishal.l.verma@intel.com> Reported-by: Maurice A. Saldivar <maurice.a.saldivar@hpe.com> Tested-by: Maurice A. Saldivar <maurice.a.saldivar@hpe.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
-rw-r--r--drivers/nvdimm/namespace_devs.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/nvdimm/namespace_devs.c b/drivers/nvdimm/namespace_devs.c
index 1427a386a033..3e4d1e7998da 100644
--- a/drivers/nvdimm/namespace_devs.c
+++ b/drivers/nvdimm/namespace_devs.c
@@ -1417,6 +1417,15 @@ static int btt_claim_class(struct device *dev)
1417 struct nvdimm_drvdata *ndd = to_ndd(nd_mapping); 1417 struct nvdimm_drvdata *ndd = to_ndd(nd_mapping);
1418 struct nd_namespace_index *nsindex; 1418 struct nd_namespace_index *nsindex;
1419 1419
1420 /*
1421 * If any of the DIMMs do not support labels the only
1422 * possible BTT format is v1.
1423 */
1424 if (!ndd) {
1425 loop_bitmask = 0;
1426 break;
1427 }
1428
1420 nsindex = to_namespace_index(ndd, ndd->ns_current); 1429 nsindex = to_namespace_index(ndd, ndd->ns_current);
1421 if (nsindex == NULL) 1430 if (nsindex == NULL)
1422 loop_bitmask |= 1; 1431 loop_bitmask |= 1;