acpi, nfit: fix register dimm error handling
commit74ef3034525acd9330be48b57df74c67f92ede3a
authorToshi Kani <toshi.kani@hpe.com>
Fri, 2 Feb 2018 21:00:36 +0000 (2 14:00 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 16 Feb 2018 19:06:59 +0000 (16 20:06 +0100)
tree204dad149d80f84cc269fea130d2ff3756c644d6
parent1a9b65ce31654f5d4edd134c5ad21a0b0846ab1a
acpi, nfit: fix register dimm error handling

commit 23fbd7c70aec7600e3227eb24259fc55bf6e4881 upstream.

A NULL pointer reference kernel bug was observed when
acpi_nfit_add_dimm() called in acpi_nfit_register_dimms() failed. This
error path does not set nfit_mem->nvdimm, but the 2nd
list_for_each_entry() loop in the function assumes it's always set. Add
a check to nfit_mem->nvdimm.

Fixes: ba9c8dd3c222 ("acpi, nfit: add dimm device notification support")
Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/acpi/nfit/core.c