From d8903b9b05b3768a92d8441fc2279e8df985ef19 Mon Sep 17 00:00:00 2001 From: zhong jiang Date: Mon, 8 Apr 2019 20:21:40 +0800 Subject: [PATCH] mm/memory_hotplug: Do not unlock when fails to take the device_hotplug_lock euler inclusion category: bugfix bugzilla: 13472 CVE: NA ------------------------------------------------ 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 Reviewed-by: Oscar Salvador Acked-by: Michal Hocko Signed-off-by: zhong jiang Reviewed-by: Jing Xiangfeng Signed-off-by: Yang Yingliang --- drivers/base/memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/base/memory.c b/drivers/base/memory.c index 1c8ad7f929a8..8de1a7c6ed42 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c @@ -521,7 +521,7 @@ memory_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, -- GitLab