Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Thumshirn <jthumshirn@suse.de>2018-08-08 12:37:09 +0200
committerJohannes Thumshirn <jthumshirn@suse.de>2018-08-08 12:37:09 +0200
commit19be07da94f27d1f0ae955d6a5ebb2e32ddd61da (patch)
tree0f34f6a446660d77c9d7ab644f66b6d3b0354406
parent1abe3886879401e9b993aafdf1d0b9738067bca0 (diff)
libnvdimm, dimm: fix dpa reservation vs uninitialized label area
(git-fixes).
-rw-r--r--patches.fixes/libnvdimm-dimm-fix-dpa-reservation-vs-uninitialized-.patch53
-rw-r--r--series.conf1
2 files changed, 54 insertions, 0 deletions
diff --git a/patches.fixes/libnvdimm-dimm-fix-dpa-reservation-vs-uninitialized-.patch b/patches.fixes/libnvdimm-dimm-fix-dpa-reservation-vs-uninitialized-.patch
new file mode 100644
index 0000000000..da8e5851b0
--- /dev/null
+++ b/patches.fixes/libnvdimm-dimm-fix-dpa-reservation-vs-uninitialized-.patch
@@ -0,0 +1,53 @@
+From: Dan Williams <dan.j.williams@intel.com>
+Date: Fri, 6 Apr 2018 11:25:38 -0700
+Subject: libnvdimm, dimm: fix dpa reservation vs uninitialized label area
+Patch-mainline: v4.17-rc1
+Git-commit: c31898c8c711f2bbbcaebe802a55827e288d875a
+References: git-fixes
+
+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>
+Acked-by: Johannes Thumshirn <jthumshirn@suse.de>
+---
+ drivers/nvdimm/dimm.c | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/nvdimm/dimm.c b/drivers/nvdimm/dimm.c
+index f8913b8124b6..233907889f96 100644
+--- a/drivers/nvdimm/dimm.c
++++ b/drivers/nvdimm/dimm.c
+@@ -67,9 +67,11 @@ static int nvdimm_probe(struct device *dev)
+ ndd->ns_next = nd_label_next_nsindex(ndd->ns_current);
+ nd_label_copy(ndd, to_next_namespace_index(ndd),
+ to_current_namespace_index(ndd));
+- rc = nd_label_reserve_dpa(ndd);
+- if (ndd->ns_current >= 0)
+- nvdimm_set_aliasing(dev);
++ if (ndd->ns_current >= 0) {
++ rc = nd_label_reserve_dpa(ndd);
++ if (rc == 0)
++ nvdimm_set_aliasing(dev);
++ }
+ nvdimm_clear_locked(dev);
+ nvdimm_bus_unlock(dev);
+
+--
+2.12.3
+
diff --git a/series.conf b/series.conf
index f96058a401..277ca891ed 100644
--- a/series.conf
+++ b/series.conf
@@ -14134,6 +14134,7 @@
patches.drivers/nfit-address-range-scrub-fix-scrub-in-progress-repor
patches.drivers/libnvdimm-add-an-api-to-cast-a-struct-nd_region-to-i.patch
patches.drivers/nfit-address-range-scrub-introduce-nfit_spa-ars_stat.patch
+ patches.fixes/libnvdimm-dimm-fix-dpa-reservation-vs-uninitialized-.patch
patches.drivers/libnvdimm-namespace-use-a-safe-lookup-for-dimm-device-name.patch
patches.drivers/nfit-address-range-scrub-determine-one-platform-max_.patch
patches.drivers/nfit-address-range-scrub-rework-and-simplify-ARS-sta.patch