Skip to content

Commit

Permalink
mm/memory_hotplug: Do not unlock when fails to take the device_hotplu…
Browse files Browse the repository at this point in the history
…g_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 8df1d0e
("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: 8df1d0e ("mm/memory_hotplug: make add_memory() take the device_hotplug_lock")
Reported-by: Yang yingliang <yangyingliang@huawei.com>
Signed-off-by: zhong jiang <zhongjiang@huawei.com>
Reviewed-by: Oscar Salvador <osalvador@suse.de>
Reviewed-by: David Hildenbrand <david@redhat.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
zhong jiang authored and Greg Kroah-Hartman committed Apr 25, 2019
1 parent affada7 commit d2ab994
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/base/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit d2ab994

Please sign in to comment.