From: zhong jiang Date: Mon, 8 Apr 2019 04:07:17 +0000 (+0800) Subject: mm/memory_hotplug: Do not unlock when fails to take the device_hotplug_lock X-Git-Tag: microblaze-v5.4-rc1~808^2~27 X-Git-Url: http://git.monstr.eu/?a=commitdiff_plain;h=d2ab99403ee00d8014e651728a4702ea1ae5e52c;p=linux-2.6-microblaze.git mm/memory_hotplug: Do not unlock when fails to take the device_hotplug_lock When adding the memory by probing memory block in sysfs interface, there is an obvious issue that we will unlock the device_hotplug_lock when fails to takes it. That issue was introduced in Commit 8df1d0e4a265 ("mm/memory_hotplug: make add_memory() take the device_hotplug_lock") We should drop out in time when fails to take the device_hotplug_lock. Fixes: 8df1d0e4a265 ("mm/memory_hotplug: make add_memory() take the device_hotplug_lock") Reported-by: Yang yingliang Signed-off-by: zhong jiang Reviewed-by: Oscar Salvador Reviewed-by: David Hildenbrand Acked-by: Michal Hocko Cc: stable Signed-off-by: Greg Kroah-Hartman --- 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,