summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhong jiang <zhongjiang@huawei.com>2019-04-18 17:50:16 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-04-27 09:37:45 +0200
commit4ae522890cc19038c84769d20f9ffdfc2d58a36b (patch)
tree7a2dbb01a3fa6747a3764e3a22b239a0022f8125
parentc138ed72186accb0dac95066118374cf6c0807ae (diff)
mm/memory_hotplug: do not unlock after failing to take the device_hotplug_lock
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. Link: http://lkml.kernel.org/r/1554696437-9593-1-git-send-email-zhongjiang@huawei.com Fixes: 8df1d0e4a265 ("mm/memory_hotplug: make add_memory() take the device_hotplug_lock") Signed-off-by: zhong jiang <zhongjiang@huawei.com> Reported-by: Yang yingliang <yangyingliang@huawei.com> Acked-by: Michal Hocko <mhocko@suse.com> Reviewed-by: David Hildenbrand <david@redhat.com> Reviewed-by: Oscar Salvador <osalvador@suse.de> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/base/memory.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index 048cbf7d5233..23125f276ff1 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -505,7 +505,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,