Skip to contentSkip to conversation

Correct memory hotplug locking

PATCH New Nathan Fontenot 1 participant 1 message Apr 7, 2015 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Correct memory hotplug locking

Memory dlpar handling can return from dlpar_memory() without releasing the device_hotplug lock. Correct this routine to ensure the lock is released.

This patch applies on top of my previous updates to memory hotplug:
https://lists.ozlabs.org/pipermail/linuxppc-dev/2015-February/124804.html

---
 arch/powerpc/platforms/pseries/hotplug-memory.c |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
arch/powerpc/platforms/pseries/hotplug-memory.c +7 -4
index 742ef88..5cefcad 100644
@@ -562,13 +562,15 @@ int dlpar_memory(struct pseries_hp_errorlog *hp_elog)
 	lock_device_hotplug();
 
 	dn = of_find_node_by_path("/ibm,dynamic-reconfiguration-memory");
-	if (!dn)
-		return -EINVAL;
+	if (!dn) {
+		rc = -EINVAL;
+		goto dlpar_memory_out;
+	}
 
 	prop = dlpar_clone_drconf_property(dn);
 	if (!prop) {
-		of_node_put(dn);
-		return -EINVAL;
+		rc = -EINVAL;
+		goto dlpar_memory_out;
 	}
 
 	switch (hp_elog->action) {
@@ -599,6 +601,7 @@ int dlpar_memory(struct pseries_hp_errorlog *hp_elog)
 	else
 		dlpar_update_drconf_property(dn, prop);
 
+dlpar_memory_out:
 	of_node_put(dn);
 	unlock_device_hotplug();
 	return rc;