[lkml]   [2019]   [Apr]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH 5.0 112/115] mm/memory_hotplug: do not unlock after failing to take the device_hotplug_lock
From: zhong jiang <>

commit 37803841c92d7b327147e0b1be3436423189e1cf upstream.

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.

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 <>
Signed-off-by: Greg Kroah-Hartman <>

drivers/base/memory.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -505,7 +505,7 @@ static ssize_t probe_store(struct device

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,

 \ /
  Last update: 2019-04-24 19:38    [W:0.436 / U:6.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site