lkml.org 
[lkml]   [2019]   [Nov]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.19 252/306] mm/memory_hotplug: Do not unlock when fails to take the device_hotplug_lock
    Date
    From: zhong jiang <zhongjiang@huawei.com>

    [ Upstream commit d2ab99403ee00d8014e651728a4702ea1ae5e52c ]

    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 <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>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    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 0f8e77f78cc80..ac1574a696100 100644
    --- a/drivers/base/memory.c
    +++ b/drivers/base/memory.c
    @@ -510,7 +510,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,
    --
    2.20.1


    \
     
     \ /
      Last update: 2019-11-27 22:23    [W:4.098 / U:0.272 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site