diff options
authorzhong jiang <>2019-04-18 17:50:16 -0700
committerLinus Torvalds <>2019-04-19 09:46:04 -0700
commit37803841c92d7b327147e0b1be3436423189e1cf (patch)
parentaf53d3e9e04024885de5b4fda51e5fa362ae2bd8 (diff)
mm/memory_hotplug: do not unlock after failing to take the device_hotplug_lock
When adding memory by probing a memory block in the sysfs interface, there is an obvious issue where we will unlock the device_hotplug_lock when we failed to takes it. That issue was introduced in 8df1d0e4a265 ("mm/memory_hotplug: make add_memory() take the device_hotplug_lock"). We should drop out in time when failing to take the device_hotplug_lock. Link: Fixes: 8df1d0e4a265 ("mm/memory_hotplug: make add_memory() take the device_hotplug_lock") Signed-off-by: zhong jiang <> Reported-by: Yang yingliang <> Acked-by: Michal Hocko <> Reviewed-by: David Hildenbrand <> Reviewed-by: Oscar Salvador <> Cc: <> Signed-off-by: Andrew Morton <> Signed-off-by: Linus Torvalds <>
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index cb8347500ce2..e49028a60429 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -506,7 +506,7 @@ static ssize_t probe_store(struct device *dev, struct device_attribute *attr,
ret = lock_device_hotplug_sysfs();
if (ret)
- goto out;
+ return ret;
nid = memory_add_physaddr_to_nid(phys_addr);
ret = __add_memory(nid, phys_addr,