Skip to contentSkip to conversation

FAILED: patch "[PATCH] libnvdimm, dimm: fix dpa reservation vs uninitialized label" failed to apply to 4.4-stable tree

PATCH [email protected] 1 participant 1 message Apr 20, 2018

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 4.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

Quoted 1 line

From c31898c8c711f2bbbcaebe802a55827e288d875a Mon Sep 17 00:00:00 2001

From: Dan Williams <[email protected]>
Date: Fri, 6 Apr 2018 11:25:38 -0700
Subject: [PATCH] libnvdimm, dimm: fix dpa reservation vs uninitialized label
area

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.

Fixes 4a826c83db4e ("libnvdimm: namespace indices: read and validate")
drivers/nvdimm/dimm.c +5 -3
index f8913b8124b6..233907889f96 100644
@@ -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);