Commit 37803841 authored by zhong jiang's avatar zhong jiang Committed by Linus Torvalds
Browse files

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 8df1d0e4 ("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.

Fixes: 8df1d0e4

 ("mm/memory_hotplug: make add_memory() take the device_hotplug_lock")
Signed-off-by: default avatarzhong jiang <>
Reported-by: default avatarYang yingliang <>
Acked-by: default avatarMichal Hocko <>
Reviewed-by: default avatarDavid Hildenbrand <>
Reviewed-by: default avatarOscar Salvador <>
Cc: <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent af53d3e9
......@@ -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,
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment