linux-stable/drivers/nvdimm
Dan Williams 33a5608671 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: 14e4945426 ("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>
2017-09-18 17:29:01 -07:00
..
blk.c block: guard bvec iteration logic 2017-07-03 16:56:26 -06:00
btt.c libnvdimm for 4.14 2017-09-11 13:10:57 -07:00
btt.h libnvdimm, btt: rework error clearing 2017-08-31 15:05:10 -07:00
btt_devs.c libnvdimm: rename nd_sector_size_{show,store} to nd_size_select_{show,store} 2017-08-11 17:36:54 -07:00
bus.c libnvdimm, nfit: move the check on nd_reserved2 to the endpoint 2017-09-04 11:02:21 -07:00
claim.c libnvdimm, btt: rework error clearing 2017-08-31 15:05:10 -07:00
core.c libnvdimm: rename nd_sector_size_{show,store} to nd_size_select_{show,store} 2017-08-11 17:36:54 -07:00
dax_devs.c Merge branch 'for-4.13/dax' into libnvdimm-for-next 2017-07-03 16:54:58 -07:00
dimm.c libnvdimm: handle locked label storage areas 2017-05-04 15:41:39 -07:00
dimm_devs.c libnvdimm, nfit: enable support for volatile ranges 2017-06-27 16:44:13 -07:00
e820.c libnvdimm, e820: use module_platform_driver 2016-12-05 08:52:21 -08:00
Kconfig pmem: add dax_operations support 2017-04-19 15:14:35 -07:00
label.c libnvdimm, label: fix index block size calculation 2017-08-29 18:28:18 -07:00
label.h libnvdimm, btt: BTT updates for UEFI 2.7 format 2017-06-29 13:50:38 -07:00
Makefile libnvdimm, dax: introduce device-dax infrastructure 2016-05-09 15:35:42 -07:00
namespace_devs.c libnvdimm, namespace: fix btt claim class crash 2017-09-18 17:29:01 -07:00
nd-core.h libnvdimm, nfit: enable support for volatile ranges 2017-06-27 16:44:13 -07:00
nd.h libnvdimm for 4.14 2017-09-11 13:10:57 -07:00
pfn.h libnvdimm, dax: autodetect support 2016-05-20 22:02:57 -07:00
pfn_devs.c libnvdimm, pfn, dax: limit namespace alignments to the supported set 2017-08-15 09:32:12 -07:00
pmem.c - Some request-based DM core and DM multipath fixes and cleanups 2017-09-14 13:43:16 -07:00
pmem.h libnvdimm, nd_blk: remove mmio_flush_range() 2017-08-31 15:05:10 -07:00
region.c libnvdimm, region, pmem: fix 'badblocks' sysfs_get_dirent() reference lifetime 2017-06-30 18:56:03 -07:00
region_devs.c nfit, libnvdimm, region: export 'position' in mapping info 2017-08-04 17:20:16 -07:00